in reply to Re: Counting Array in an Array of HoA
in thread Counting Array in an Array of HoA

reneeb,
Thanks so much for your reply. I wonder what do these two lines do?
my $test = join('.*?',@$arref); $string =~ $test # this is the first time # I see "=~" used in non-regex context # what's the purpose?
Regards,
Edward

Replies are listed 'Best First'.
Re^3: Counting Array in an Array of HoA
by omega_monk (Scribe) on May 09, 2005 at 16:03 UTC
    No, I believe the "=~" is used in regex there, from my minimal understanding $test is the string that contains the regex. I am still trying to understand the how on the rest of the script, though.

    Update: After some testing, I used a much simpler version to get to this.
    #!/usr/bin/perl -w use strict; my $string='ABCD'; my $string1='DCBA'; my $test='.*?AB'; print "Matched in $string" if $string =~ $test; # Prints Match. print "Matched in $string1" if $string1 =~ $test; # Does not print + Match.

    So $test does contain the regex '.*?AB' or '.*?BA'. If I am not correct here, please let me know.

    Update: Adjusted code to differentiate the output.