Hey all.

I have a subroutine that may want to
modify a parameter passed in via @_.

however, it shouldn't modify it if
it is read-only. how do you test
for a writable parameter in perl?

sub pluralize
{
        $_[0] .= 's';
}


my $thingy = 'apple';
pluralize($thingy); # this will work

pluralize('orange'); #boom!

the only thing I can think of offhand is
to do the assign in an eval block.
is this the best way?


Greg

Reply via email to