Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: grep in line and print

by roboticus (Canon)
on Jan 24, 2013 at 02:23 UTC ( #1015065=note: print w/ replies, xml ) Need Help??


in reply to grep in line and print

justbow:

That code certainly doesn't do what you think it does. Add a print $line,"\n"; statement just after foreach to see why.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: grep in line and print
Select or Download Code
Re^2: grep in line and print
by justbow (Initiate) on Jan 24, 2013 at 02:36 UTC
    do u mean like this :
    foreach print $line,"\n"; (@macall) {
    it will be error :D

      justbow:

      No, I meant like this:

      my @macall = qw(print @input); foreach $line (@macall) { print "<$line>\n"; if ($line =~ /C4:46:19:75:C1:55:\s+(\S+)/) { $id = $1; } } print "ID = $id"; return (0);

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015065]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2014-12-19 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (75 votes), past polls