Regex work fine, but seems like using a fork to spread butter and cut bread. Whats wrong with:
1: die 'insufficient arguments' unless @ARGV == 1;
2: open(IN, $ARGV[0]) or die "unable to open '$ARGV[0]'";
3: while (my $line = <IN>) {
4: my $prefix = sprintf '%4d', $.;
5: print "$prefix: $line";
6: }
7: close IN;
8:
or
1: die 'insufficient arguments' unless @ARGV == 1;
2: open(IN, $ARGV[0]) or die "unable to open '$ARGV[0]'";
3: while (my $line = <IN>) {
4: my $prefix = sprintf '%4d: ', $.;
5: print $prefix . $line;
6: }
7: close IN;
8:
?