Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Here there be camels!

by hildred (Initiate)
on Feb 28, 2015 at 22:31 UTC ( [id://1118200]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Here there be camels!
in thread Here there be cammels!

In the second pass the file is closed.

Replies are listed 'Best First'.
Re^5: Here there be camels!
by LanX (Saint) on Feb 28, 2015 at 22:40 UTC
    warn takes a string as argument, so just add the coordinates you want.

    Just let the string end with a newline "\n" to avoid other numbers to be added automatically.

    warn "Warning at FILE.pl line 42, <> line 666.\n";

    et voila!

    Warning at FILE.pl line 42, <> line 666.

    besides:

    The example code you gave is nonsense, because foreach slurps the whole file, line-numbers are lost.

    Better use while !

    Otherwise please post code demonstrating your problem and the expected output.

    update

    If you want the first FILE and NUMBER to be the correct current ones, put your warn into a sub and use caller to get them, before constructing your string.

    Alternatively use Carp to report from the callers context.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)

    PS: Je suis Charlie!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-16 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found