Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: The Comma Operator

by kael (Monk)
on Jul 21, 2001 at 10:10 UTC ( [id://98630]=note: print w/replies, xml ) Need Help??


in reply to The Comma Operator

With the comma list of prints your just making a list and ignoring it's acutal value
think about this
@a=(foo,bar,bah);
valid code, right? now how bout this?
(foo,bar,bah);
Again valid code, it doesn't do anything but it's valid and will get evalated. Code doesn't HAVE to do something. Now if you can also do
@a=(joe(),someothersub());
This will set @a to the return values of joe and someothersub, your doing the same thing with print
(joe(),someothersub());
or
(print("hello"),print "\n");
This is also valid code, calls both functions puts their return values into a list, and then forgets the list.
(feel free to correct me if I'm wrong)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-24 07:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found