in reply to sanity check
That's insane! ;-)
Compare your script with this refactored version.
#!perl use strict; use warnings; use autodie qw( open close ); open my $input_fh, '<:encoding(UTF-8)', shift @ARGV; open my $output_fh, '>:encoding(UTF-8)', 'Output.txt'; while (my $line = <$input_fh>) { chomp $line; my @tokens = split ' ', $line; if ($tokens[0] eq 'object-group') { print {$output_fh} "set shared address-group $tokens[2]\n"; } } close $input_fh; close $output_fh; exit 0;
UPDATE: Changed « my @tokens = split m/ /, $line; » to « my @tokens = split ' ', $line; ».
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sanity check
by jwkrahn (Abbot) on Sep 21, 2011 at 00:21 UTC | |
by ww (Archbishop) on Sep 21, 2011 at 02:38 UTC | |
by jwkrahn (Abbot) on Sep 21, 2011 at 05:39 UTC | |
by BrowserUk (Patriarch) on Sep 21, 2011 at 03:12 UTC |