Am 04.03.2014 00:35, schrieb shawn wilson:
So, when I do this:
my $src = (grep {/.*(ARIN|APNIC).*(\n)?/; $1} @ret)[0];
I get a full line and not just the capture:
# ARIN WHOIS data and services are subject to the Terms of Use
When I do this:
my $src = (grep {s/.*(ARIN|APNIC).*(\n)?/$1/} @r
On 2014-03-04 00:35, shawn wilson wrote:
So, when I do this:
my $src = (grep {/.*(ARIN|APNIC).*(\n)?/; $1} @ret)[0];
I get a full line and not just the capture:
# ARIN WHOIS data and services are subject to the Terms of Use
First understand what you coded:
grep() is a filter: it only passes
On 03/03/2014 23:35, shawn wilson wrote:
So, when I do this:
my $src = (grep {/.*(ARIN|APNIC).*(\n)?/; $1} @ret)[0];
I get a full line and not just the capture:
# ARIN WHOIS data and services are subject to the Terms of Use
When I do this:
my $src = (grep {s/.*(ARIN|APNIC).*(\n)?/$1/} @ret
On Mar 4, 2014 9:46 AM, "Shawn H Corey" wrote:
>
> On Tue, 4 Mar 2014 09:24:53 -0500
> shawn wilson wrote:
>
> > my $src = (map {s/.*(ARIN|APNIC).*(?:\n)?/$1/r} @ret)[0];
>
> You do realize this is process the whole array and then throwing out
> all but the first? And it has the side effect of mo
On Tue, 4 Mar 2014 09:24:53 -0500
shawn wilson wrote:
> my $src = (map {s/.*(ARIN|APNIC).*(?:\n)?/$1/r} @ret)[0];
You do realize this is process the whole array and then throwing out
all but the first? And it has the side effect of modifying the array?
--
Don't stop where the ink does.
It needs to be grep as a map would return the first line no matter
what - not what I want. Also, this doesn't work:
sub whois
{
my ($whois) = @_;
my $sock = IO::Socket::INET->new(
PeerAddr=>$whois,
PeerPort=>'43',
Timeout=>'60',
);
return undef unless (defined($sock));
$soc
On Mon, 3 Mar 2014 18:35:55 -0500
shawn wilson wrote:
> So, when I do this:
> my $src = (grep {/.*(ARIN|APNIC).*(\n)?/; $1} @ret)[0];
> I get a full line and not just the capture:
> # ARIN WHOIS data and services are subject to the Terms of Use
If you can't figure out what's wrong, neither wil
I think you want to use 'map' instead of grep.
HTH, Ken
On Mon, Mar 3, 2014 at 6:35 PM, shawn wilson wrote:
> So, when I do this:
> my $src = (grep {/.*(ARIN|APNIC).*(\n)?/; $1} @ret)[0];
> I get a full line and not just the capture:
> # ARIN WHOIS data and services are subject to the Terms o