I have Python code that uses the "with" keyword (new in 2.6) and I want to check if the interpreter version is at least 2.6, so I use this code:
import sys
if sys.version < '2.6':
raise Exception( "python 2.6 required" )
However, the 2.4 interpreter chokes on the with keyword (later in the script) because it doesn't recognize the ...
I have a quite simple perl script, that in one function does the following:
if ( legato_is_up() ) {
write_log("INFO: Legato is up and running. Continue the installation.");
$wait_minutes = $WAITPERIOD + 1;
$legato_up = 1;
}
else {
my $towait = $WAITPERIOD - $wait_minutes;
write_...
I want to know if there is anything that lets me do the following:
folder1 has files "readfile1" "f2" "fi5"
The only thing I know is that I need to read the file which starts with readfile, and I don't know what's there in the name after the string readfile. Also, I know that no other file in the directory starts with readfile.
How d...
i have about 5 years of work in PHP/JS/CSS and other web technologies , as web developer , i feel i should move to learn another languages , other things , but there is huge stack of languages and technologies today : JAVA/( Modern JAVA frameworks ) , C/C++ , Python , Ruby/ROR , Perl , Mobile development ...etc , and this make me confus...
I want to iterate through a reference to an array of hashes without having to make local copies, but I keep getting Can't use string ("1") as an ARRAY ref while "strict refs" errors. Why? How do I fix it?
sub hasGoodCar {
my @garage = (
{
model => "BMW",
year => 1999
...
I started to write a module for scheduling perl jobs with more readable syntax than a cron job, but wondered if there was already one available.
I'm after something that can be run from a perl script, not a crontab file. This syntax has got to be easily readable. For example :-
every Monday morning
every other Tuesday at 3:30pm
every ...
My name is abbi
My first perl script run on linux machine
This script read the INI file called (input) and print the values of val , param , name .....
How to create loop that print values of val1-valn OR loop to print values of param1-paramn... etc? (in place the print command's in the script )
the loop must have option to match t...
I'm new to using the Perl treebuilder module for HTML parsing and can't figure out what the issue is with this.. I have spent a few hours trying to get this to work and looked at a few tutorials but am still getting this error: "Use of uninitialized value in pattern match ", referring to this line in my code:
sub{ $_[0]-> tag() eq 'div'...
for ex :
my $ret =system("which mysql");
if ($ret!=0) {
print " error " ;
}
if mysql exutable is not there. its should show which command error messgae.
I want to show my own error message .
...
Hello,
I'm quite new to Perl development, and I'd like to perform a following task:
My script receives hex-encoded string as command-line param. Then I must decode this string and write it to output file like a C++ array with initialization from data given. For example:
perl myscript.pl DEADBABEDEADBEEF
and the output something like
...
Hello,
In perl, to get a list of all strings from "a" to "azc", to only thing to do is using the range operator:
perl -le 'print "a".."azc"'
What I want is a list of strings:
["a", "b", ..., "z", "aa", ..., "az" ,"ba", ..., "azc"]
I suppose I can use ord and chr, looping over and over, this is simple to get for "a" to "z", eg:
>...
system("ssh test.host.com");
its asking for permentaly add key or not ?
I want automatically it should say yes !
...
Hi
I am using Expect in perl to connect to remote machine and execute certain functions. sample code is like
$outfile="ls -lrt";
$outfile1="output";
$exp->expect(30,-re,".*bash-.*" => sub{$exp->send("$outfile2 >$outfile \r")});
$exp->expect(60,-re,".*bash-.*" => sub{$exp->send("$shayam > $Ram \r")});
Even if the first expression fai...
The situation is this: My system (Win XP Pro) is unable to copy a huge video file (around 6 gigs) from a DVD disk, which might be defective, scratched or whatever but which can be played back with mplayer with a few frames full of mosaic though. When the copying process lasted for a certain length of time, the system would abort the effo...
I am looking to match strings out of a file that are prefixed
/**
and have a postfix
*/
With any number of characters/whitespace/newlines in between.
eg:
/** anything
anything
*/
I have m/(\/\*\*).*?(\*\/)/ so far, however this does not handle newlines. I know the fix has to be simple, but i have very limited regular exp...
Right now we have a large perl application that is using raw DBI to connect to MySQL and execute SQL statements. It creates a connection each time and terminates. Were starting to approach mysql's connection limit (200 at once)
It looks like DBIx::Connection supports application layer connection pooling.
Has anybody had any experience...
I'm trying to get this to work with perl's regex but can't seem to figure it out.. I want to grab any url that has ".website." in it, except ones that are like this (with "en" preceding ".website."
$linkhtml = 'http://en.search.website.com/?q=beach&' ;
This is an example of a url that I would want to be returned by the regex, ...
I'm an experienced perl developer who commonly uses Catalyst/Moose etc for web development, and have some python/django knowledge. I'm interested in learning java with an eye on wicket/spring/hibernate and later on possibly moving towards groovy, scala or closure.. I'd rather not plough through all the basics.. What do you recommend book...
Hi All,
We use svnnotify (i.e. SVN::Notify) in our svn post-commit hook. Is it possible to include the userid of the author of the commit as the displayed name in the author field of the resulting email? Authentication is through mod_auth_mysql. We don't want the author to be "userid@domain of svn server" because there are no such em...
I got this question in a previous interview and couldnt do it , any idea?
What does this do:
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;...