angie ahl wrote:
> The following regex is failing strangely:
> 
>       my @tables = $content =~ m#\[table\](.*?)\[/table\]#g;
>       foreach (@tables) {
>               my $table = $_;
>               if ($content =~ m#$table#) {print "yes old table is there!\n";}
>       }
> 
> @tables contains 2 items (correctly) but seaching for each item in
> $content does not match.
> 
> How can it find 2 matches and then claim that each of them aren't
> there? 
> 
> Perl 5.8.6 Mac OS X 10.3.8
        I am running AS 5.8.3 build 809.

Here is the script I ran and it worked:
#!perl

use strict;
use warnings;
use Data::Dumper;
my $content = <<'MYCONTENT';
[table]  1212312321 [/table]
[table]   123213312 [/table]

MYCONTENT

    my @tables = $content =~ m#\[table\](.*?)\[/table\]#g;
    print Dumper([EMAIL PROTECTED]);
    
        foreach (@tables) {
                my $table = $_;
                if ($content =~ m#$table#) {print "yes old table is there!\n";}
        }

Output:
$VAR1 = [
          '  1212312321 ',
          '   123213312 '
        ];
yes old table is there!
yes old table is there!

Wags ;)
> 
> Thanks
> 
> bemused Angie



*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to