Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by AnomalousMonk (Bishop)
on Mar 07, 2021 at 08:43 UTC ( #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? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2022-07-07 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?