in reply to Re^2: Regular expression problem
in thread Regular expression problem

Still, there has got to be a better way than what you are doing. Perhaps you should use the named-parameter-list style of passing parameters to subroutines. Perhaps something like this?

print_html( onChange => qq{ document.approveform.command.value='approve'; document.approveform.submit(); }, onClick => qq{ if (this.disabled) { alert('some text!'); } } ); sub print_html { my %param = @_; print "onChange: $param{'onChange'}\n" if ( exists $param{'onChange'} ); print "onClick: $param{'onClick'}\n" if ( exists $param{'onClick'} ); }

Replies are listed 'Best First'.
Re^4: Regular expression problem
by jeffa (Bishop) on Jun 09, 2004 at 15:31 UTC

    Bend like a soft reed in the wind:

    sub print_html { my %param = @_; exists $param{$_} and print "$_: $param{$_}\n" for qw(onChange onClick); }

    jeffa

    I guess i should note for the record that this was my 2112th node, a Rush reference.