in reply to looking for simple way to check scalar against array
#!/usr/bin/perl -w use strict; my $i = 4; my @nums = ( 1 .. 9 ); push (@nums, -12); for (@nums) { print if /$i/; }
UPDATE#!/usr/bin/perl -w use strict; my $i = 4; for ( 1 .. 9, -12 ) { print if /$i/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: looking for simple way to check scalar against array
by ikegami (Patriarch) on May 19, 2005 at 15:11 UTC | |
|
Re^2: looking for simple way to check scalar against array
by dug (Chaplain) on May 19, 2005 at 15:12 UTC | |
|
Re^2: looking for simple way to check scalar against array
by blazar (Canon) on May 19, 2005 at 15:09 UTC |