XML, the Perl Way

Processing XML with Perl Michel Rodriguez

Data Structures

Regular Expressions

Control Structures

tests

  if( $var == 1) { $var2= 1} 
  elsif( $var1 eq "toto") { $var2= 0; }
  else { $var2= -1; }
unless( $var != 1) { $var2= 1}

loops

while

  $i=1; while( $i < 10) { print "$i\n"; $i++; }

for/foreach

  for( $i=1; $i<10; $i++) { print "$i\n"; }
  for $i (1..10) { print "$i\n";}
  foreach $file (@files) { next if( $file eq '.'); print "file: $file\n"; }
  foreach $key (keys @hash) { print "item: $key => $hash{$key}\n"; }


Data Structures

Regular Expressions