Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Is there a better way to use the line number in a quoted string than __LINE__?

by AnomalousMonk (Archbishop)
on Mar 07, 2021 at 08:43 UTC ( [id://11129250]=note: print w/replies, xml ) Need Help??


in reply to Is there a better way to use the line number in a quoted string than __LINE__?

... a better way ...

Maybe
    printf "Line %s looks very nice\n", __LINE__;
or
    printf "Line %d looks very nice\n", __LINE__;
which don't seem so bad to me.

NB: This is hardly unfanny, but works:

Win8 Strawberry 5.8.9.5 (32) Sun 03/07/2021 3:40:51 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings print "Line ${ \__LINE__ } is ok syntactically \n"; ^Z Line 1 is ok syntactically


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-26 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found