Command disabled: edit
 

Exemple de code Perl

#!/usr/bin/perl
 
=comment
 
  tp1.1.a.pl
  Débroussailler des log d'un serveur de mails
  Version filtre
 
  syntaxe Perl: man perlsyn
 
=cut
 
use Data::Dumper ;                   # cf man Data::Dumper
use strict ;
 
my %h ;                                           # 1 hash
 
while(<>)
{
  my ($id,$rest) = /([0-9A-F]{10}):(.*)/ ;
  push(@{$h{$id}},$rest) if $id ;        # cf man perlfunc
}
 
print Dumper \%h ;                        # cf man perlref
#!/usr/bin/perl
use Data::Dumper ;                   # cf man Data::Dumper
use strict ;
 
my %h ;                                           # 1 hash
 
while(<>)
{
  my ($id,$rest) = /([0-9A-F]{10}):(.*)/ ;
  push(@{$h{$id}},$rest) if $id ;        # cf man perlfunc
}
 
print Dumper \%h ;
exempleperl.txt · Last modified: 2011/12/21 11:44 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki