Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Passing a reference from a subroutine.

by Anonymous Monk
on Dec 07, 2012 at 16:34 UTC ( #1007783=note: print w/replies, xml ) Need Help??


in reply to Re: Passing a reference from a subroutine.
in thread Passing a reference from a subroutine.

Sorry, that was a typo, and even with "return \@AoA;" it still doesn’t work.
  • Comment on Re^2: Passing a reference from a subroutine.

Replies are listed 'Best First'.
Re^3: Passing a reference from a subroutine.
by roboticus (Chancellor) on Dec 07, 2012 at 16:39 UTC

    The syntax is clearly correct (as shown in the example below). So if you're getting the proper data with Dumper in your for loop, then you're likely damaging the data between the Dumper call and your return statement.

    $ cat t.pl #!/usr/bin/perl use strict; use warnings; sub get_data { my $data = shift; my @AoA = (1 .. $data); return \@AoA; } my $aref = get_data(5); print join(", ", @$aref), "\n"; marco@Boink:/Work/Perl/Sudoku $ perl t.pl 1, 2, 3, 4, 5

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Maybe how I am formatting the data is not conventional right?
      push @{ $AoA[$c] },$$one_num, $$account_num, $name, $new_name, $plano +, $passdate, $todays_date, $descont, $firm, $value, $thetotal, $commi +ted;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007783]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2017-11-23 04:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (328 votes). Check out past polls.

    Notices?