Hi,

I would like to propose adding the "last" statement
to the "grep", which currently doesn't work:

  maas34: perl -e 'grep { print and $_ == 3 and last } (1,2,3,4,5)'
  123
  Can't "last" outside a loop block at -e line 1.

This way it would be possible to use such constructs:


  print_header ($query);

  if ($but and not check_pass ($pass))
  {
      print abstract (q{<SPAN CLASS="pink">Wrong password</SPAN> ...
  }
  elsif ($but eq 'Create' and $proj and $sub and $pack and $prel)
  {
      insert_update_pack ($dbh, $proj, $sub, $pack, $prel);
  }
  elsif (grep { /^Delete\s+([\w.-]+)\|([\w.-]+)\|([\w.-]+)\|([\w.-]+)$/ and
                $query -> param ($_) eq 'Delete' and last } $query -> param)
  {
      delete_pack ($dbh, $1, $2, $3, $4);
  }
  else
  {
      print abstract (q{Please specify a project and ...
  }


Here I am looking for a button with a special name - "Delete ..." -
and there can be only one such button, so I have to interrupt the
"grep" after I find it (otherwise the $1, $2, $3, $4 might be unset).
I have to do it this strange way (using NAME and not the VALUE of
an HTML submit-button), because the VALUE is shown as the label of 
the button (and I  want it to show just "Delete", not "Delete CAPC|blah...")

Regards
Alex

Reply via email to