in reply to Passing array pointer through script input

It's nonsense. ;)

If you try `perl myscript.pl \@arr`; the \ quotes the @ and you end up with '@arr'. You could:

my $ref = \@arr; `perl myscript.pl $ref`;

but Perl would stringify $ref to something of the form: ARRAY(0x182df38).

However, none of this is solving your real problem. But then, you haven't actually told us what your real problem is. Take a couple of steps back in your thinking and tell us what you are trying to solve with this technique.


Perl reduces RSI - it saves typing

Replies are listed 'Best First'.
Re^2: Passing array pointer through script input
by vit (Friar) on Aug 20, 2008 at 22:44 UTC
    OK, the whole story.
    I am passing file paths in the loop from the main script through several levels of script calls. In the bottom I read files and process.
    Sinse main script is also looped, I want to do something like to store files in array of arrays once and read from these arrays instead of reading from files which should be much faster.

      Sounds like premature optimization. If the work you are doing per file is significant then the minor overhead of reading a list from a small file is trivial.

      It may be worth using something like DBM::Deep to store the list of files to be processed however to make management of the list easier and perhaps faster.


      Perl reduces RSI - it saves typing
        The file has a special structure with addressing which allows a quick regection and that's why reading is a bottleneck not processing. Processing is much faster.
        I do not want to change this part and therefore I do not think I can use DBM::Deep.
        So actually the question is if it's possible to effectively pass arrays to called scripts. Join to a long string with /\n/ separator and then split inside...? Or how?