Processing XML with Perl | ![]() |
Michel Rodriguez |
![]() Control Structures |
![]() |
![]() Object-Oriented Perl |
while(<>) { process( $_) }; |
open( FILE, "<file") or die "cannot open file: $!"; my @lines= <FILE>; |
# sort the keys alphanumerically foreach ( sort keys %hash) { process( $_, $hash{$_}); } # sort the keys numerically foreach my $key ( sort { $a <=> $b} keys %hash) { process( $key, $hash{$key}); } |
![]() Regular Expressions |
![]() |
![]() Object-Oriented Perl |