Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: CGI.pm, combining two strings

by stuffy (Monk)
on May 07, 2001 at 23:54 UTC ( #78627=note: print w/replies, xml ) Need Help??


in reply to Re: CGI.pm, combining two strings
in thread CGI.pm, combining two strings

correct, I posted the part of the cgi that created the html that made the form. it also appears that I can use a comma or a period according to the posts that I have received from others

Stuffy

Replies are listed 'Best First'.
Commas and Periods
by TGI (Parson) on May 08, 2001 at 02:26 UTC

    The comma operator (,) acts as a list separator. When you feed print and bunch of stuff with commas in-between you are saying print this list of things. In a scalar context the comma evaluates the left arg and dumps the value, then it evaluates the right arg and returns the result.print scalar('foo','bar','this'); gets you this

    The period (.) is the string concatenation operator. It combines strings. It also wants its operands in scalar context.

    $a = 'abc'; $d = 'def'; $A = $a.$b; #ie, $A='abcdef' print $A.$a.$b;

    This code prints abcdefabcdef. Here I say print this one thing that you can make by putting these things together.

    Though they seem to do much the same thing when you're printing, they are actually quite different. Watch out for the scalars only aspect of .!


    TGI says moo

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2021-10-23 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (87 votes). Check out past polls.

    Notices?