I'm looking for some assistance on a script which can go through the lines of an array, printing them to the screen and stopping when the script detects a specific character, in this case the !
mark. I have tried using the foreach
statement but ain't getting any success...
Example of the Array (@lines
) contents is:
ip vrf test
rd 2856:10000331
export map SetAltMgmtRT
route-target export 2856:10000331
route-target import 2856:10000331
maximum routes 1000 75
!
The script I have so far is:
elsif ( $action eq "show_vrf" ) {
my $cmd = "show run | begin <VRF_NAME>";
$cmd = $cmd . " | i $include" if($include) ;
my @lines = $s->cmd(String => $cmd,
Prompt => "/$enableprompt/",
Timeout => 10);
foreach $lines (@lines) {
<statement, this is where I am stuck>
}
print $lines;
Any help would be appreciated :)