in reply to Re: substr in nested foreach loop
in thread substr in nested foreach loop

A nice way to parse the coordinates is using Regexp::Common.
use Regexp::Common; ... my $num = $RE{num}{real}; my ($x, $y, $z) = ($1, $2, $3) if $line =~ /($num) ($num) ($num)\s*$/;

Replies are listed 'Best First'.
Re^3: substr in nested foreach loop
by sarani (Sexton) on May 23, 2006 at 04:19 UTC
    :D thank you.
Re^3: substr in nested foreach loop
by Anonymous Monk on May 23, 2006 at 05:33 UTC
    Isn't the behavior of "my" with an "if" modifier unspecified? I think
    my ($x, $y, $z) = ($line =~ /($num) ($num) ($num)\s*$/);
    would do what you want here. If it doesn't match all three variables will be undefined.
      okay, thank you.