Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by davidfilmer (Sexton)
on Mar 07, 2021 at 08:24 UTC ( [id://11129248]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
         #!/usr/bin/perl
            print "Line [ ", __LINE__, " ] looks very nice\n";
            print "Line [  __LINE__ ] is taken as a string-literal\n";
           #print "Line [ @{[__LINE__}] is a syntax error\n";
    
  2. or download this
         Line [ 2 ] looks very nice.
         Line [  __LINE__ ] is taken as a string-literal.
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found