lhp@nereida:~/Lperl/src$ cat -n example1.pl 1 #!/usr/bin/perl -w 2 use strict; 3 4 while (defined($_ = <STDIN>)) { 5 if (/__END__/) { last; } 6 elsif (/LHP/) { print; } 7 } 8 9 =head1 NAME example1.pl 10 11 =head1 SYNOPSIS 12 13 example1.pl < file 14 15 =head1 DESCRIPTION 16 17 Reads file C<file> and prints all the lines containing 18 the string C<LHP> up to a line containing 19 the string C<__END__>. For example given the input file: 20 21 lhp@nereida:~/Lperl/src$ cat -n example1.input 22 1 Esta linea no se imprime 23 2 Esta linea si se imprime LHP 24 3 Esta no 25 4 Esta LHP si 26 5 __END__ 27 6 y se acabo LHP 28 7 esta linea tampoco sale 29 30 the program produces the following output: 31 32 lhp@nereida:~/Lperl/src$ example1.pl < example1.input 33 Esta linea si se imprime LHP 34 Esta LHP si