Typos wrote: > Hello everyone, Hello,
> I'm a Perl beginner and I've been trying for a while to to insert an array > in to the middle of another array perldoc -f splice > after a certain pattern. More difficult. You first have to determine at what array index the pattern exists. > Here is what I'm trying to do...I have the Linux Iptables configuration > file, A file is not an array, unless you use the Tie::File module. > which has a custom chain called MAC which hold all the IP to MAC > entries mappings. Since I update the list manually, I usually end up > with IP addresses here and there...I managed to put all the sorted > IP to MAC entries on a seperate array, and then remove all the MAC > entries from the original file...So what I basically need to do is > insert the sorted iptables array between the INPUT and OUTPUT > chains. Here is a sample output of the array, when all MAC entries > are removed... When all MAC entries are in the file are they all grouped together like the FORWARD, INPUT and OUTPUT entries? Where do you get the "sorted iptables array" from? Perhaps something like this (UNTESTED): while ( <FILE> ) { if ( ?^-A OUTPUT? ) { print @sorted_iptables; } print; } John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/