Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

how to push single array?

by virudinesh (Acolyte)
on May 13, 2013 at 09:02 UTC ( #1033269=perlquestion: print w/ replies, xml ) Need Help??
virudinesh has asked for the wisdom of the Perl Monks concerning the following question:

push(@figer1,$rep); push(@figer,$rep1); 1. this operation was different but how to push same array in $rep.$r +ep1 variable...

Comment on how to push single array?
Download Code
Re: how to push single array?
by Anonymous Monk on May 13, 2013 at 09:11 UTC

    Please use more words when asking a question, and describe what you want to happen, and how its different from what it happens

    As your question is written I cannot determine what you're asking

    So I offer you this (dd does printing)
    codeoutput
    #!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd /; my @feet = qw/ left right /; my @shoes = qw/ loader sneaker boot /; my @things; dd { feet => \@feet, shoes => \@shoes, things => \@_ }; push @shoes, qw/ slippers /; dd { feet => \@feet, shoes => \@shoes, things => \@_ }; push @things, \@feet, \@shoes; dd { feet => \@feet, shoes => \@shoes, things => \@_ };
    { feet => ["left", "right"], shoes => ["loader", "sneaker", "boot"], things => [], } { feet => ["left", "right"], shoes => ["loader", "sneaker", "boot", "slippers"], things => [], } { feet => ["left", "right"], shoes => ["loader", "sneaker", "boot", "slippers"], things => [], }

    Also please read perlintro and use Basic debugging checklist (among others)

      haha, what the heck is a "loader" shoe? typos fixed
      codeoutput
      #!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd /; # sub dd { use Data::Dumper; print Data::Dump +er->new([@_])->Sortkeys(1)->Indent(1)->Useqq(1)->Dump . "\n"; } my @feet = qw/ left right /; my @shoes = qw/ loader sneaker boot /; my @things; dd { feet => \@feet, shoes => \@shoes, things => \@things }; push @shoes, qw/ slippers /; dd { feet => \@feet, shoes => \@shoes, things => \@things }; push @things, \@feet, \@shoes; dd { feet => \@feet, shoes => \@shoes, things => \@things };
      { feet => ["left", "right"], shoes => ["loader", "sneaker", "boot"], things => [], } { feet => ["left", "right"], shoes => ["loader", "sneaker", "boot", "slippers"], things => [], } do { my $a = { feet => ["left", "right"], shoes => ["loader", "sneaker", "boot", "slippers"], things => ['fix', 'fix'], }; $a->{things}[0] = $a->{feet}; $a->{things}[1] = $a->{shoes}; $a; }
        "loader" -> "forklift" -> "high heels"?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2014-12-17 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (40 votes), past polls