-----Original Message-----
From: Ryan Moszynski [mailto:[EMAIL PROTECTED]
Sent: Monday, July 24, 2006 12:41 PM
To: [email protected]
Subject: passing a list as a variable
Is there a way to make my commented 'foreach" line act the same as the
line above it?
Can I pass a list as a variable as I am trying to do, or doesn't perl
support that?
###########
#!/usr/bin/perl -w
$|=1;
#use strict;
system "clear";
my @array = 1024;
my $list4 = "0..10,33..43,100..111";
foreach (0..10,33..43,100..111){
#foreach ($list4){
$array[$_] = $_;
print "array--$array[$_]-- --$_--\n";
}
###########
Is this what you want to do?
foreach ((0..10,33..43,100..111)) {
or
my @list4 = (0..10,33..43,100..111);
foreach (@list4) {
jwm
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>