in reply to Re: Pattern matching across an array
in thread Pattern matching across an array

But @array isn't interpolated anywhere. The =~ operator doesn't impose any magical interpolation of the LHS. Instead, @array is in scalar context, and @array in scalar context is the length of the array.

my @foo = 1..5; print @foo =~ /5/; # prints '1' for success.
Update: Oops, sorry, my bad. Missed the parenthesis in the OP.

ihb

Replies are listed 'Best First'.
Re: Re: Re: Pattern matching across an array
by tommyw (Hermit) on Feb 06, 2003 at 10:46 UTC

    If you notice, Foxcub has tried stringifying the array, by enclosing it in quotes. That's where the interpolation happens.

    my @foo = 1..5; print "@foo" =~ /1 2 3 4 5/; # prints '1' for success.

    --
    Tommy
    Too stupid to live.
    Too stubborn to die.