in reply to Calling subroutine syntax

Prototyping?
#!/usr/bin/perl #can use prototype to get around passing hashrefs to subs my_sub(%hash) #prototype for my_sub sub my_sub(\%) { my $hash_ref = shift; map { print "$_ => $$hash_ref{$_} \n" } keys %$hash_ref; }

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re: Re: Calling subroutine syntax
by japhy (Canon) on May 01, 2004 at 14:43 UTC
    You need to define the prototype before you can use the function.
    sub my_sub (\%) { ... } my_sub(%hash);
    Or if you want to define your function later:
    sub my_sub (\%); my_sub(%hash); sub my_sub (\%) { ... }
    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;