in reply to Re^2: using foreach with a regex
in thread using foreach with a regex

whenever you can one, you can also use the other instead.
Almost.
Almost. moritz just said that you can use the other, not that you'll get the same result. :-)

Replies are listed 'Best First'.
Re^4: using foreach with a regex
by JavaFan (Canon) on Dec 05, 2008 at 16:55 UTC
    Well, you cannot (unless you want to include fatal (run time) errors in 'not getting the same result').
    $ perl -wE 'sub for {say "Hello"} &for' Hello $ perl -wE 'sub foreach {say "Hello"} &for' Undefined subroutine &main::for called at -e line 1.