Perl Foreach Array

By Albert on August 7, 2011 11:31 AM

Perl has all these funky magic vairables, like $_. Its tough because they are useful with foreach loops, like this one:

foreach (@myarr) {
    print $_;
}

An expanded example:

  1 my @x = [];
  2 $xa = "a, b, c,d";
  3 @x = split(/[,]\ ?/, $xa);
  4 foreach $item (@x) {
  5   $key = $item;
  6   if($key eq 'c') {
  7     print $key;
  8     print "\n";
  9   }
 10 }

Testing Environments

By Albert on October 31, 2009 1:27 AM

I used to have several machines setup specifically for testing and experimentation.

Nowadays I only use virtual servers to run tests and experiments. Soooo much easier, and cheaper to run.

Virtualization is a wonderful thing indeed.

Categories