in reply to Re: Decompose a String into Tuples (Faster and Compact Way)
in thread Decompose a String into Tuples (Faster and Compact Way)

Is there a reason for the \$s1 stuff? It seems to work just fine without....

#!perl -l my $s1 = q/X -4 Y 3 Z/; my $s2 = q/W 1 X -4 Y 3 Z/; my $s3 = q/X 2 Y/; my $s4 = q/A -4 B -4 C -4 A -4 B/; for ( $s1, $s2, $s3, $s4 ) { print for /(?=(\S+\s+-?\d+\s+\S+))/g; }

Don't forget that for aliases its iterator, which is basically a funny kind of reference that doesnt need to be dereferenced.

---
$world=~s/war/peace/g