in reply to Re: Iterating and pattern matching on input file
in thread Iterating and pattern matching on input file
Thanks for your response. Yeah, that's exactly what I want - "next line", rather than "next". I've updated the code but doesn't seem to be working?
my $item = "UNKNOWN"; if ( $line =~ m/show port/ ) { $item = + "port"; } if ( $line =~ m/show router interface/ ) { $item = + "l3"; } if ( $line =~ m/Count:\s+(\d+)/ ) { $checks{$item}{$stage} = + $1; }
$VAR1 = { 'subs' => { 'post' => '2', 'pre' => '2' }, 'bfd' => { 'post' => 0, 'pre' => 0 }, 'ospf' => { 'post' => '2', 'pre' => '2' }, 'UNKNOWN' => { 'post' => '28615', 'pre' => '28615' }, 'ldp' => { 'post' => '14', 'pre' => '14' } };
Am I missing something?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Iterating and pattern matching on input file
by roboticus (Chancellor) on Jul 31, 2018 at 23:50 UTC | |
|
Re^3: Iterating and pattern matching on input file
by AnomalousMonk (Archbishop) on Jul 31, 2018 at 23:57 UTC |