in reply to Re: Referencing a Backreference
in thread Referencing a Backreference
Wouldn't something like this be a lot simpler?
So true, but it can be done even simpler!
split with no arguments is like split ' ', $_, which in turn has a special meaning because of the chr(32) string. I think you can asume ip adresses and hostnames do not contain whitespace...my (@ips, @names); while (<DATA>) { my ($ip, $name) = split; push @ips, $ip; push @names, $name; }
my %hash = map split, <DATA>; my @ips = keys %hash; my @names = values %hash;
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Two splits for the price of one!
by belg4mit (Prior) on Mar 14, 2002 at 20:26 UTC |