<div dir="ltr">If you have a function that's going to read a file and return the output, and perhaps trigger special behavior if no permissions or file doesn't exist or something, how would you handle parameters?<br clear="all"><div><br></div><div>What I am engaging right now looks like this.<br><br>    read_this_file( $special , $output, $input );<br><br>Where $output is an arrayref. </div><div><br>What I think is a better way of doing this is <br><br>    $output = read_this_file( $input , $special );<br><br>With the signatures feature in more recent Perls, you can set the signature like <br><br>    sub read_this_file ( $input , $special = 1 ) { ... }<br><br>so that it defaults to the wanted behavior, or reverse it or not. Of course, with old syntax, you could also do it.<br><br>sub read_this_file {<br>    my $file = shift;<br>    my $special = shift;</div><div>    $special //= 1;<br>    ...<br>}<br><br>So it's more the question of param syntax than function header syntax.</div><div><br></div><div>Do any of you have strong behavior? <br><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Dave Jacoby<br>
<a href="mailto:jacoby.david@gmail.com" target="_blank">jacoby.david@gmail.com</a><br>
<br>I deal with my software the way I treat my eldritch abomination: <br> It's not human, it's not even alive in the natural sense. </div><div dir="ltr"> It's nightmare-born and nightmare-shaped, and nightmares don't die easy.<br>  -- @yenzie</div></div></div></div></div>