in reply to Code behaves differently in script and on command line

The error message wasn't all that helpful about it, that's all :

Because you hadn't changed the parsing rules (i.e. declared the prototype) yet,

rmap {print} $system_data;

was taken to meant

print()->rmap($system_data);

Perl is rightfully complaining that print isn't returning an object.

Replies are listed 'Best First'.
Re^2: Code behaves differently in script and on command line
by monsieur (Initiate) on Jun 26, 2009 at 11:01 UTC
    Hmm.. so you are saying that perl was trying to run a function called rmap, returned in an object from a call to print ?

    EDIT: Nevermind really, I see that you are correct and I understand that this is tricky business for the interpreter since I want to use a raw code block like that ...
      It was executing method rmap of the object it expected print to return. method object @args is called the indirect method call notation.