in reply to Attempt to free unreferenced scalar

I assume the source you posed is really from a .pm file, correct? When you save it as a .pl and feed it directly into perl, it dies with "Can't return outside a subroutine" but I suspect you're really "use"ing it from another file.

What does the code in that other file look like?

  • Comment on Re: Attempt to free unreferenced scalar

Replies are listed 'Best First'.
Re: Re: Attempt to free unreferenced scalar
by meetraz (Hermit) on Feb 23, 2004 at 05:13 UTC
    When I save your code as 'VM_List.pm' and call it like this, it works fine:

    use lib 'c:\temp'; use VM_List; my @testarray = (1,2,3); my $test = VM_List->create(\@testarray); print "test=$test";

    Although calling it with "-Wc" gives me:

    v-string in use/require non-portable at c:\temp/VM_List.pm line 1.

    So I believe that should be a 'require' instead of 'use'. And shouldn't your other use lines come after your package line?

      And shouldn't your other use lines come after your package line?

      Should they?

      For modules that export by default, I want it outside my package space. For strict/warnings, I want them turned on at the earliest oppertunity.