So, I have a bash script inside of which I'd like to have a conditional which depends on what a perl script returns. The idea behind my code is as follows:
for i in $(ls); do
if $(perl -e "if (\$i =~ /^.*(bleh|blah|bluh)/) {print 'true';}"); then
echo $i;
fi;
done
Currently, this always returns true, and when I tried it ...
I'm just going through perlxstut and I found there newSVnv in EXAMPLE 5 and EXAMPLE 6 but I think that newSVuv should be more appropriate. Curiously newSVnv works too. What's going on?
...
To compare with diff adjacent records from a file, I created two FIFOs, forked children to supply their write ends, and captured the output of
diff -ub $previous $current
where the scalars contain the FIFOs’ paths—kind of how bash process substitution works.
This is not a program that needs to be bullet-proof, but if it were, how wou...
Hi,
I have html that looks like this,
<div>
<span>Text
<a href="example.html">ABC</a>
<a href="example.html">DEF</a>
<a href="example.html">HIJ</a>
<a href="example.html">KLM</a>
</span>
<p class="Time">
09/28/10 - 03:46 PM EDT</p>
</div>
I need to loop through the <a> tags between the <span> ...
Hi,
I wanted to know how do Catalyst and Mason differ. Do they both do similar things? I have heard that amazon uses Mason for their websites. Can catalyst be used in similar manner?
...
I have a Perl Script which was built on a Linux platform using Perl 5.8 . However now I am trying to run the Perl Script on a Windows platform command prompt with the same Perl version.
I am using this command perl rgex.pl however it gives me one whole chunk of errors which looks to me like it has already been resolved in the script it...
I have currently a DNS Reverse lookup script which works however there is a small little issue of the script being able to output the DNS system errors.
The problems goes like this:
User keys in false/wrong internet address name etc. "www.whyisthednsnothappening.com"
The script would then clear the screen using system(clear)
The scrip...
I think this might be a fairly easy question.
I found a lot of examples using threads and shared variables but in no example a shared variable was created inside a thread. I want to make sure I don't do something that seems to work and will break some time in the future.
The reason I need this is I have a shared hash that maps keys to ...
If I want to create a *nix symlink, I'll call symlink();, if i'm running a script on windows and I want to create a shortcut, I'd use Win32::Shortcut.
But what if I want to create a Windows shortcut if running a script from a *nix machine?
I'm accessing a SMB share on a Windows Server 2003 machine from my *nix machine.
...
Hi, i am trying to change this:
foreach $require (@Required) {
# If the required field is the email field, the syntax of the email #
# address if checked to make sure it passes a valid syntax. #
if ($require eq 'email' && !&check_email($Config{$require})) {
push(@error,$require);
}
...
Nothing I've tried can get my code to submit correctly. Can anyone else figure this out?
#!/usr/bin/perl
use WWW::Mechanize;
my $user = '[email protected]';
my $pass = 'hackswipe';
# Test account; don't worry
my $browser = WWW::Mechanize->new();
$browser->get("https://www.paypal.com/");
$browser->form_with_fields("login_e...
Possible Duplicate:
Can I send STDOUT and STDERR to a log file and also to the screen in Win32 Perl?
I would to to redirect STDOUT, STDERR to temp_log and then to logfile.txt after the process is complete. The process runs for complete 20 minutes thus I would like to flock the temp_log in the time process runs.
...
I need to create a Monte Carlo simulator for some financial transactions. The inputs would be:
the average percent of transactions that end up profitable
the average profit per transaction
the number of transactions per time period
I've looked at the Math::Random::MT::Auto Perl module but am unsure how to formulate the inputs to the...
I'm trying to update my status through the Twitter API and OAuth.
I get stuck on the last step, the status update. Here's my code.
The header:
$ua->default_header('Content-Type' => "application/x-www-form-urlencoded");
$ua->default_header('oauth_signature' => "$signature");
$ua->default_header('Authorization' => '"OAuth realm="Twitter...
My apologies if this comes across as a newbie question. I'm not a Perl developer, but am trying to use it within an automation process, and I've hit a snag.
The following command runs quickly (a few seconds) on my Linux system (Ubuntu 9.10 x64, Perl 5.10), but is extremely slow on a Windows system (Windows 2003 x86, Strawberry Perl 5.12...
I am writing a Perl script that needs to transfer files between computers using scp. I know about public key authentication, but I need the script to be fully automated, so I can't visit the machines to set up the keys before the script is run.
Is there any way to either pass the password to scp from the Perl script or set up the keys f...
I am writing a Perl script which does this :
Reads the values of the environment variables a to z in a loop.
Depending on the value of the environment variables, generates a result file similar to
a - 1,2,3,4
b - a,b,c
c - $234.34,$123.12
keyword1 %a%
keyword2 %b%
keyword3 %c%
The point to note is that all the declarations have to c...
How can I tell CPAN to give Makefile.PL one specific argument in one specific installation?
Specifically. I want to install XML::LibXML, and apt-get installed the library to /usr/lib/libxml2.so.2.6.32. Makefile.PL has problems with that and tells me:
using fallback values for LIBS and INC
options:
LIBS='-L/usr/local/lib -L/usr/lib -l...
Suppose I have a utility library (other) containing a subroutine
(sort_it) which I want to use to return arbitrarily sorted data.
It's probably more complicated than this, but this illustrates the
key concepts:
#!/usr/local/bin/perl
use strict;
package other;
sub sort_it {
my($data, $sort_function) = @_;
return([sort $sort_fun...
I seem to recall (though can't find any reference now) to one being able to do something akin to
my @a = ("foo","bar");
my ($item1, $item2) = @a;
The above does not do what I want it to (obviously) but I seem to recall that there is some way to do this, where it loads the items associated with the order of the scalars in the parenthes...