Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: strict subs and bareword exceptions

by dvergin (Monsignor)
on Feb 22, 2002 at 08:25 UTC ( [id://146902]=note: print w/replies, xml ) Need Help??


in reply to strict subs and bareword exceptions

print nono => "1";   is not the same as
print nono, 1;   or even
print nono, "1";

That is because the "=>" also quotes the bareword that comes before it.
The equivalent non-"=>" statement would be:

      print 'nono', "1";

In the statement:
      print nono => "1";
the "=>" is not acting as a dot. Rather it really is acting as a comma (plus the quoting of the preceding bareword). The two values ("nono" and "1") are simply being printing one after the other.

Mind you, at some deeper level, the list following the print statement is being concatenated. But I would encourage you not to make explanations about "=>" becoming a dot in that situation. This will just confuse things.

------------------------------------------------------------
"Perl is a mess and that's good because the
problem space is also a mess.
" - Larry Wall

  • Comment on Re: strict subs and bareword exceptions

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 19:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found