Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] $_[0].....

Expand Messages
  • anguilla1969@comcast.net
    You can also using shift when assigning variables passed to a subroutine. for example: sub myRoutine () { $arg1 = $_[0]; $arg2 = $_[1]; $arg3 = $_[2]; } is
    Message 1 of 7 , Jul 3, 2004
    • 0 Attachment
      You can also using "shift" when assigning variables passed to a subroutine. for example:

      sub myRoutine () {
      $arg1 = $_[0];
      $arg2 = $_[1];
      $arg3 = $_[2];
      }

      is the same as ...

      sub myRoutine () {
      $arg1 = shift;
      $arg2 = shift;
      $arg3 = shift;
      }






      [Non-text portions of this message have been removed]
    • merlyn@stonehenge.com
      ... anguilla1969 You can also using shift when assigning variables passed to a subroutine. for example: anguilla1969 sub myRoutine () { anguilla1969
      Message 2 of 7 , Jul 3, 2004
      • 0 Attachment
        >>>>> "anguilla1969" == anguilla1969 <anguilla1969@...> writes:

        anguilla1969> You can also using "shift" when assigning variables passed to a subroutine. for example:
        anguilla1969> sub myRoutine () {
        anguilla1969> $arg1 = $_[0];
        anguilla1969> $arg2 = $_[1];
        anguilla1969> $arg3 = $_[2];
        anguilla1969> }

        anguilla1969> is the same as ...

        anguilla1969> sub myRoutine () {
        anguilla1969> $arg1 = shift;
        anguilla1969> $arg2 = shift;
        anguilla1969> $arg3 = shift;
        anguilla1969> }

        Not exactly. Try using @_ to mean "the remaining arguments" in
        the first way vs the second way. Only the second way works. That's
        why I generally do that now. It's cleaner, and lets me get at the
        "rest" of the args at the end.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      • Allan Dystrup
        Oops! I wasn t aware this was an ILLEGAL copy - i thought it was a way to hook people on buying the hard copy version... sorry / allan ... 777 0095 ...
        Message 3 of 7 , Jul 9, 2004
        • 0 Attachment
          Oops!

          I wasn't aware this was an ILLEGAL copy - i thought it was
          a way to hook people on buying the 'hard copy' version...

          sorry /
          allan


          --- In perl-beginner@yahoogroups.com, merlyn@s... wrote:
          > >>>>> "Allan" == Allan Dystrup <allan_dystrup@y...> writes:
          >
          > Allan> Take a look at:
          > Allan> http://[[illegal copy of Perl CD-ROM]]
          >
          > Please do not advertise pirated copies of the O'Reilly CD-ROMs here.
          > That offends me greatly. You take dollars directly from my pocket
          > when you do that.
          >
          > Please send such URLs to infringement@o... for enforcement action.
          >
          > --
          > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
          777 0095
          > <merlyn@s...> <URL:http://www.stonehenge.com/merlyn/>
          > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
          > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
          training!
        Your message has been successfully submitted and would be delivered to recipients shortly.