help with a little perl script and assigning variables
hello,
I have the following input Quote:
Quote:
I want to make it so there can be multiple matching statements, but the parent is always accurate. I tried a few things, but I am stuck trying to make that work. Right now all I have is a blank foreach loop: Code:
foreach my $class (@dump_class) { Any help will be great. |
Code:
if( $class /^class_map/ ) |
doesn't seem to work. I am posting my entire script as there is a few things I like to point out (is ugly)
Code:
1 #!/usr/bin/perl The output is just the entire line: Quote:
TIA |
/^class_map/ shouldn't be /^class-map/ ?
|
Yep, that was a typo by me. I always use vars 'like_this', never 'like-this', so I get into the habit of underscores...
Sorry... :( |
Ok must be something elementary that I am missing here. This is what I used:
Quote:
Quote:
thanks |
Try uncomment (and replace the \n with a space):
#print "$test_arr[2]\n"; eg, make it like: print "$test_arr[2] . ' '; [edit] Sorry, I overlooked your second if block, I see you use: print "$test_arr[2] $group_val[2] $group_val[3]\n"; |
Well, I did say it was untested; I wrote it in a hurry as in 'you need something like this'
;) anyway, this has been tested :) Code:
open(IN, "<", "t.t") or die "Unable to open t.t: $!\n"; Code:
VOIP-Control access-group 101 |
Thanks a lot. After a few minor tweaks this is working.
|
All times are GMT -5. The time now is 09:07 PM. |