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

Re: Displaying an array in a cgi generated textarea

by fruiture (Curate)
on Feb 27, 2003 at 18:18 UTC ( #239187=note: print w/ replies, xml ) Need Help??


in reply to Displaying an array in a cgi generated textarea

An array in double quotes (which equals qq//) is interpolated and the result is ...

print "left @array right"; # try perl -MO=Deparse for that: print 'left '.join($",@array).' right'

So you see, perl uses $" as the seperator of the array elements, $" is by default just a single space character, you can simply change that. Use local() to avoid problems with other code, because CGI.pm afaik uses $", too.

local $" = ''; #... -default => "@source", #... #or even -default => do { local $" = ''; "@source" }, #or better -default => join('',@source)

HTH, see perlvar

--
http://fruiture.de


Comment on Re: Displaying an array in a cgi generated textarea
Select or Download Code
Re: Re: Displaying an array in a cgi generated textarea
by martymart (Deacon) on Feb 27, 2003 at 18:31 UTC
    Thanks fruiture,
    just tried it... works great,
    valuable lesson learned...
    Martymart

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2015-07-05 20:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls