However, better would be to rewrite it as# Exactly equivalent drop-in replacement sub get_my_params { map { defined param( $_ ) ? param( $_ ) : '' } qw( ticket title client next_step o_date o_time ); }
The use of a hash is better because you can add new parameters to get_my_params() and the only thing that changes is the new code you add. You don't need to keep track of a bazillion parameter names.# Returns a hash, not an array sub get_my_params { map { $_ => defined param( $_ ) ? param( $_ ) : '' } qw( ticket title client next_step o_date o_time ); } # Use this one as so: my %params = get_my_params(); if ( $params{ title } ne '' ) { # Do stuff here. }
Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
In reply to Re: Scalar evaluation
by dragonchild
in thread Scalar evaluation
by mhearse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |