array not printing what I want

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
#!/usr/bin/perl -w
use strict;

my $SUBNET  = '172.16.70.';
my @MEMBERS = qw/

foreach my $node ( @MEMBERS )

print "$node\n"


I want it to print the IP address.

Re: array not printing what I want

Quoted text here. Click to load it

See perldoc perlop, "Quote and Quote-like Operators" for why this
doesn't work.

To interpolate you need to use double quotes:

my @MEMBERS = (

and of course in this case a map could be used to save typing:

my @MEMBERS = map "$$_", qw(66 68 70 72);


Site Timeline