Hello. I'm not a new perl programmer, but I feel like one today. I
want to pull the last octet off of an IP address and print it to
standard output. I have this so far:
@octets = split(/\./, $ipAddress);
print pop(@octets);
Which works great. I have no other use for @octets, so I should be able
to just pass the results of split() right to pop():
print pop(split(/\./, $ipAddress));
However, I get the error message
Type of arg 1 to pop must be array (not split) at ./oct.pl line
8, near "))"
I realize I need to make sure the results of split() are an array before
they're passed to pop(). Fine. However,
print pop(@{split(/\./, $ipAddress)});
prints nothing. split() *does* return an array, right? Why can't pop
take it?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/