in reply to Re: Regex and array
in thread Regex and array
Hi Corion and everyone
thanks in advance for your answer. The problem is not that it can't read the file. The lines i posted above where just there for shorten the problem. I usually put the "use strict" pragma and the die() instruction in my scripts to prevent what you correctly pointed out.
This time, indeed, the problem is that if I try to match the array's elements without cycling them with a foreach, I can't get a match.
I'll try to post a maybe better example
didn't work for me. Is the syntax wrong? Am I missing something? Thanks again for your help.#!/usr/bin/perl my @array = qw( ciccio paperino palla gigio pluto ); my $test = pluto; if ( $test =~ $array[0..$#array] ) { print "It matched!\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex and array
by toolic (Bishop) on May 25, 2010 at 12:47 UTC | |
by Deus Ex (Scribe) on May 25, 2010 at 13:07 UTC | |
|
Re^3: Regex and array
by Corion (Patriarch) on May 25, 2010 at 12:41 UTC | |
by Deus Ex (Scribe) on May 25, 2010 at 12:56 UTC | |
|
Re^3: Regex and array
by vtheron (Novice) on May 25, 2010 at 21:38 UTC | |
by Deus Ex (Scribe) on May 26, 2010 at 09:50 UTC |