Re: Testing an array for a match
[email protected] ("John W. Krahn")
| Newsgroups | perl.beginners.cgi |
|---|---|
| Message-ID | <[email protected]> |
Lou Hernsen wrote:
> Hallo
Hello,
> 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:/){}
if ( grep /:1:2:3:/, @Treasures ) {
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall