in reply to Double Splits?
I make no guarantee as to speed, relevence, or any other thing. Also, if you want just the first list element that's got x#y#z in it, you will need to do away with map and substitute something like, <code>split( /#/, (include function to grab just first list element here) ).$scalar = '1|2|3#4#5#6|789'; @list = split(/\|/,$scalar); @prefs = map {if (/#/) {split(/#/,$_);} } @list; print "\@list: " . join (' ', @list) . "\n"; print "\@prefs: ". join (' ', @prefs) . "\n";
|
|---|