Perl tricks
Downloading a webpage using Perl and LWP.
#!/usr/bin/perl -w
use strict;
use LWP::Simple qw(!head);
my $url = "http://www.andreaswaelchli.com/index.php";
getstore( $url, 'filename.txt' );
use strict;
use LWP::Simple qw(!head);
my $url = "http://www.andreaswaelchli.com/index.php";
getstore( $url, 'filename.txt' );
Some simple array functions in Perl.
#!/usr/bin/perl -w
use strict;
my @fruits = ("Apple", "Pear", "Orange");
# join
my $fruitstring = join(";", @fruits);
# split
my @fruitsplit = split(/;/, $fruitstring);
# push: add element to array
push(@fruits, "Banana");
# shift: delete first element of array
my $apple = shift(@fruits);
use strict;
my @fruits = ("Apple", "Pear", "Orange");
# join
my $fruitstring = join(";", @fruits);
# split
my @fruitsplit = split(/;/, $fruitstring);
# push: add element to array
push(@fruits, "Banana");
# shift: delete first element of array
my $apple = shift(@fruits);