Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: perl javascript help passing varable

by thunders (Priest)
on Oct 16, 2009 at 15:17 UTC ( #801573=note: print w/ replies, xml ) Need Help??


in reply to Re^2: perl javascript help passing varable
in thread perl javascript help passing varable

If it was an array it'd be called @number. However $number may be an array reference. If it is an array reference you can dereference it inside of a double quoted string, as in the example below.

$number = [1,2,3]; @number = (4,5,6); print "$number @$number @number";

prints something like this:

ARRAY(0x814cc20) 1 2 3 4 5 6

Perl's default behavior is to separate an arrays elements with spaces in double quoted context. If you instead wanted to separate with commas you could do something like this:

my $comma_sep_number = join(",",@$number); print "My Array Contains: $comma_sep_number";

prints:

My Array Contains: 1,2,3


Comment on Re^3: perl javascript help passing varable
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (15)
As of 2015-07-28 13:43 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 (255 votes), past polls