run unix commands in perl
Posted in Perl on May 18th, 2006 5 Comments »
to run a unix command in a perl script, use backticks. for example to call curl in perl: `curl -o file.out “http://stinkpot.afraid.org:8080″`
Posted in Perl on May 18th, 2006 5 Comments »
to run a unix command in a perl script, use backticks. for example to call curl in perl: `curl -o file.out “http://stinkpot.afraid.org:8080″`
Posted in Perl on February 25th, 2006 No Comments »
i’m still new to perl, but it appears that the language lacks a built-in switch capability. and, i’ve had bad luck with getting the bundled switch module working. after some poking around online, i’ve finally gotten something resembling a switch statement working: # pull down input $choice = ; chomp($choice); for ($choice) { /i/ && [...]
Posted in Perl on February 16th, 2006 14 Comments »
sometimes, if you put a print statement inside of a loop that runs really really quickly, you won’t see the output of your print statement until the program terminates. sometimes, you don’t even see the output at all. the solution to this problem is to “flush” the output buffer after each print statement; this can [...]
Posted in Perl on February 11th, 2006 No Comments »
the perl DBI module allows perl to talk with mySQL. to install: >>perl -MCPAN -e ‘install Bundle::DBI’ you’ll then need to install the mysql driver for perl: >>perl -MCPAN -e ‘install DBD::mysql’
Posted in Perl on February 9th, 2006 No Comments »
to get the median of an array of numbers, first install the numbercruncher module. then, use the following code: my($medianValue) = Math::NumberCruncher::Median(\@numArray);
Posted in Perl on February 9th, 2006 No Comments »
the math::numbercruncher module has a bunch of useful array functions, like “mean” and “median.” to install, type the following at the command prompt: >> perl -MCPAN -e ‘install Math::NumberCruncher’
Posted in Perl on February 9th, 2006 No Comments »
lwp has a bunch of useful perl modules for interacting with webpages. here’s how to install: at the prompt, go with: >> perl -MCPAN -e ‘install Bundle::LWP’
Posted in Games, Perl on February 7th, 2006 4 Comments »
during an undergrad winter break, i was into yahoo’s word racer and experimenting with perl and shell-scripting. i thought it would be a nice little exercise to try and combine the two. the zip file linked here is the product of this learning experience. enclosed within it is a program that will exhaustively solve each [...]
Posted in Perl, Unix on February 6th, 2006 7 Comments »
argh, i wasted about an hour the other day trying to parse an excel file in perl. i thought i could just save the file as a “tab-delimited” file and load the .txt file in perl. things didn’t work out however, as perl (and the unix command line) thought the .txt file was just one [...]