It seems someone taught you how to program outside of Perl before she taught you how to program inside of Perl. ;-)
Here's my riff on kcott's script…
#!/usr/bin/env perl use strict; use warnings; use autodie qw( open close ); use English qw( -no_match_vars ); my $input_file = 'input.txt'; my $output_file = 'output.txt'; my $start = 17; my $end = 30; open my $input_fh, '<', $input_file; open my $output_fh, '>', $output_file; LINE: while (my $line = <$input_fh>) { next LINE if $INPUT_LINE_NUMBER < $start; last LINE if $INPUT_LINE_NUMBER > $end; print {$output_fh} $line; } close $input_fh; close $output_fh; exit 0;
And here's a greatly reduced version using <ARGV> and STDOUT instead of hardwiring file names inside the script…
#!/usr/bin/env perl use warnings; while (<>) { next if $. < 17; last if $. > 30; print; }
In reply to Re^3: System command not working
by Jim
in thread System command not working
by muchyog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |