in reply to elsif greping
Posting only on the issue you stated, it looks like you've got some syntax errors regarding parens. Untested:
for my $object (@objects) { if (grep { $_ !~ /$object/ } @config){ ... } elsif (grep { /^PPS/ } @objects){ print $fp "object-group service $object \n"; } else { print $fp "object-group network $object \n"; } }
elsif requires a condition within the traditional brackets () to examine. eg: elsif (1 == 1){ ... }. You should always have use warnings; and use strict; at the top of your scripts. In this case, you may have, but you didn't show the actual warn/error message, so it's hard to tell.
Hopefully this is enough to get you going. If not, please post back with the literal warnings/errors you received.
-stevieb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: elsif greping
by H0tc@xe (Initiate) on Sep 26, 2015 at 01:43 UTC | |
by Anonymous Monk on Sep 26, 2015 at 01:57 UTC |