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

$_[0].....

Expand Messages
  • Kathryn Tate
    What does $_[0] stand for? Thanks in advance, Kathryn
    Message 1 of 7 , Jul 2, 2004
    • 0 Attachment
      What does $_[0] stand for?

      Thanks in advance,
      Kathryn
    • Allan Dystrup
      ... Take a look at: http://iis1.cps.unizar.es/Oreilly/perl/learn/ch08_04.htm best regards / allan dystrup
      Message 2 of 7 , Jul 3, 2004
      • 0 Attachment
        --- In perl-beginner@yahoogroups.com, Kathryn Tate <kathryntate@c...>
        wrote:
        > What does $_[0] stand for?
        > Thanks in advance,
        > Kathryn

        Take a look at:
        http://iis1.cps.unizar.es/Oreilly/perl/learn/ch08_04.htm
        best regards / allan dystrup
      • Charles K. Clarkson
        ... It is the first element of @_. @_ is used by perl to send arguments to a subroutine. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328
        Message 3 of 7 , Jul 3, 2004
        • 0 Attachment
          Kathryn Tate <kathryntate@...> wrote:

          : What does $_[0] stand for?

          It is the first element of @_. @_ is used
          by perl to send arguments to a subroutine.


          HTH,

          Charles K. Clarkson
          --
          Mobile Homes Specialist
          254 968-8328
        • merlyn@stonehenge.com
          ... 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
          Message 4 of 7 , Jul 3, 2004
          • 0 Attachment
            >>>>> "Allan" == Allan Dystrup <allan_dystrup@...> 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@... for enforcement action.

            --
            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!
          • 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 5 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 6 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 7 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.