in reply to Pass class object as argument to perl script

It is possible if you call secondscript with do command.

# firstscript.pl my $object = new Object; do 'secondscript.pl';

# secondscript.pl print $object;

There is no passing argument but variables declared in firstscript are visible in secondscript

Replies are listed 'Best First'.
Re^2: Pass class object as argument to perl script
by shmem (Chancellor) on Oct 31, 2008 at 08:30 UTC
    There is no passing argument but secondscript can use variables declared in firstscript

    Right, but only if the variable is declared with our, in both files, see perlfaq8:

    1) do $file is like eval `cat $file`, except the former 1.1: searches @INC and updates %INC. 1.2: bequeaths an *unrelated* lexical scope on the eval'ed code.

    my variables are file scoped and thus not visible in secondscript.pl.

      Yes, I forgot to check it. thx