in reply to Reaped: challenge on perl
Hi johnrock47, what have you tried here? Is this just homework? I'll provide a solution based on my local machine's arp table (as you haven't supplied the config file on the server you mentioned), but I doubt it's homework worthy... show what attempt you've made and you'll get better help:
arp -a | perl -MData::Dump -anE '$F[1]=~s/(?:\)|\()//g;$h{$F[1]}=$F[3] +}{dd\%h' { "172.31.219.36" => "00:ae:da:23:85:d0", "192.168.1.1" => "48:f8:b3:3c:30:33", "192.168.1.115" => "70:77:81:43:ae:ab", "192.168.1.138" => "84:38:38:9b:61:64", "192.168.1.140" => "00:ac:1a:61:0e:66", "192.168.1.143" => "<incomplete>", "192.168.1.4" => "<incomplete>", }
You've been here since October... How do I post a question effectively?
update: I tried to golf it a bit more, but I couldn't figure out how to put the substitution within the assignment to the hash. Without a lot of time to test, it appeared as though the expression was returning match count perhaps, instead of result. Can anyone tell me how to get the result returned in such a case?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: challenge on perl (-lansE)
by Anonymous Monk on Dec 02, 2015 at 02:57 UTC | |
by stevieb (Canon) on Dec 02, 2015 at 03:01 UTC | |
|
Re^2: challenge on perl
by johnrock47 (Initiate) on Dec 15, 2015 at 23:28 UTC |