Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need to split xe-2/2/0 to (xe 2 2 0) . Here is my code and is not getting split
my @intf_list = ("xe-1/2/0", "xe-2/2/0"); foreach my $myint (@intf_list) { my @outputlist = split /-\d+/, $myint; print "$outputlist[1]\n"; }
Its not matching any pattern . Is there a way to split 2 different patterns using a single command
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting 2 different patterns
by choroba (Cardinal) on Mar 17, 2015 at 11:24 UTC | |
|
Re: Splitting 2 different patterns
by Corion (Patriarch) on Mar 17, 2015 at 11:25 UTC | |
|
Re: Splitting 2 different patterns
by karlgoethebier (Abbot) on Mar 17, 2015 at 11:37 UTC | |
|
Re: Splitting 2 different patterns
by Tux (Canon) on Mar 17, 2015 at 14:06 UTC | |
|
Re: Splitting 2 different patterns
by jeffa (Bishop) on Mar 17, 2015 at 17:52 UTC | |
|
Re: Splitting 2 different patterns
by Anonymous Monk on Mar 17, 2015 at 11:53 UTC | |
by karlgoethebier (Abbot) on Mar 17, 2015 at 12:03 UTC | |
by AnomalousMonk (Archbishop) on Mar 17, 2015 at 12:18 UTC | |
by choroba (Cardinal) on Mar 17, 2015 at 12:21 UTC | |
by karlgoethebier (Abbot) on Mar 17, 2015 at 13:08 UTC |