Guest User

Untitled

a guest
Oct 18th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #!/path/to/perl
  2. use strict;
  3. use warnings;
  4. use IO::File;
  5.  
  6. my $write_fh = IO::File->new( 'sample.log', 'w' );
  7. my $read_fh = IO::File->new( 'sample.log', 'r' );
  8.  
  9. $write_fh->print( "line1\n" );
  10. $write_fh->print( "line2\n" );
  11. $write_fh->print( "line3\n" );
  12.  
  13. system( 'cat sample.log' );
  14.  
  15. while( <$read_fh> ) {
  16. chomp;
  17. print "[$_]\n";
  18. }
Add Comment
Please, Sign In to add comment