Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Passing a reference from a subroutine.

by roboticus (Chancellor)
on Dec 07, 2012 at 16:39 UTC ( #1007786=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re^4: Passing a reference from a subroutine.
by Anonymous Monk on Dec 07, 2012 at 18:25 UTC
    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://1007786]
help
Chatterbox?
[davido]: Exactly: SoPW. This isn't going to be solved easily in the CB.
[james28909]: in need "yesterday" and so on, to be absolute like "1" or "31"
[stevieb]: ...and throw some of your existing code into the equation as well, just so readers know you've given a try at it ;)
[james28909]: ok
[stevieb]: davido thanks for the link ;) I was being the typical lazy
[davido]: date parsing is hard. The more examples you can provide of the input (within reason) and expected output, the better.
[stevieb]: agreed. That's why I said at least a half-dozen. If enough of the different formats are present, the date/time folk may not have to request more. If they do, then at least there was a decent base to start with
[stevieb]: I do date and time transformations in both Perl and Python, but not frequently enough to not have to search for the format params etc ;)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2017-04-29 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (531 votes). Check out past polls.