close, but leave out the qw.

foreach($name,$age,$phone){
        print "$_ ";
}

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 1:12 AM
To: Beginners Perl Mailing List
Subject: Looping through variables


Hello, All:

I'm trying to loop through a list of variables and print their values. 
e.g., print $name, $age, $phone.

What's the best way to do this? I've tried

        foreach (qw(name age phone)) {
                print ${$_};
        }

.....but that doesn't seem to work.

-- 
Eric P.
Los Gatos, CA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to