Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/path/to/perl
- use strict;
- use warnings;
- use IO::File;
- my $write_fh = IO::File->new( 'sample.log', 'w' );
- my $read_fh = IO::File->new( 'sample.log', 'r' );
- $write_fh->print( "line1\n" );
- $write_fh->print( "line2\n" );
- $write_fh->print( "line3\n" );
- system( 'cat sample.log' );
- while( <$read_fh> ) {
- chomp;
- print "[$_]\n";
- }
Add Comment
Please, Sign In to add comment