in reply to Regex practice script

while ((say "Input template string:") && ($string = <>) ) { while ((say "Input pattern:") && ($pattern = <STDIN>)) {

That should be:

while ((say "Input template string:") && defined(my $string = <>) ) { while ((say "Input pattern:") && defined(my $pattern = <STDIN>)) {

If you enter "0" for either $string or $pattern your loop will end prematurely.

Replies are listed 'Best First'.
Re^2: Regex practice script
by JavaFan (Canon) on Jul 25, 2011 at 14:15 UTC
    If you enter "0" for either $string or $pattern your loop will end prematurely.
    Rubbish.

    It's impossible to enter a false string. All strings entered contain a newline.

Re^2: Regex practice script
by kindlychung (Initiate) on Jul 25, 2011 at 15:35 UTC
    Tested it, not really an issue here, but thanks for paying attention.