On Thu, Apr 10, 2008 at 1:07 AM, Lou Hernsen <[EMAIL PROTECTED]> wrote:
> Hallo
>
> I have an array
> @Treasures
> and I want to match anywhere in it for
> /:1:2:3:/
> can I
> if (@Treasures =~ /:1:2:3:/){}
> or do i have to change (@Treasures to $Treasures and then
> $Treasures = @Treasures ;
> if ($Treasures =~ /:1:2:3:/){}
>
You can use a 'grep', like:
use strict;
my @x = (11,22, ':1:2:3:xxx', 'ab','cd', 'test:1:2:3:dd:ee');
my @seen = grep {/:1:2:3:/} @x;
print "@seen";
Good luck with your family.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/