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

parse arg variables...

Expand Messages
  • cside30
    Hello, I am a newbie to perl. I am getting data from an arg with multiple blocks of data. for example, a variable named, $abendstatus, will have a value of
    Message 1 of 6 , Dec 12, 2007
      Hello,

      I am a newbie to perl.

      I am getting data from an arg with multiple blocks of data.
      for example, a variable named, $abendstatus, will have a value of
      "Ended Not OK" as data.

      How do I parse this data into 3 different variables to show as

      $line1 = ended
      $line2 = Not
      $line3 = OK


      Thanks...
    • merlyn@stonehenge.com
      ... cside30 Hello, cside30 I am a newbie to perl. cside30 I am getting data from an arg with multiple blocks of data. cside30 for example, a variable
      Message 2 of 6 , Dec 12, 2007
        >>>>> "cside30" == cside30 <kpatters@...> writes:

        cside30> Hello,
        cside30> I am a newbie to perl.

        cside30> I am getting data from an arg with multiple blocks of data.
        cside30> for example, a variable named, $abendstatus, will have a value of
        cside30> "Ended Not OK" as data.

        cside30> How do I parse this data into 3 different variables to show as

        cside30> $line1 = ended
        cside30> $line2 = Not
        cside30> $line3 = OK

        You don't want three different variables. Hint: any variable that ends in a
        sequence, like "1" "2" "3" or "a" "b" "c" means you should have put that
        information into a data structure instead.

        You might want:

        $data = "Ended Not OK";
        @words = split ' ', $data;

        now $words[0] is "Ended", and so on.

        --
        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!
      • cside30
        WOW... Thanks... Can you recommend a book or an online book where I can educate myself more on that command?? I was looking online on Perl.org is that a good
        Message 3 of 6 , Dec 12, 2007
          WOW...

          Thanks...

          Can you recommend a book or an online book where I can educate myself
          more on that command?? I was looking online on Perl.org is that a good
          website??



          --- In perl-beginner@yahoogroups.com, merlyn@... wrote:
          >
          > >>>>> "cside30" == cside30 <kpatters@...> writes:
          >
          > cside30> Hello,
          > cside30> I am a newbie to perl.
          >
          > cside30> I am getting data from an arg with multiple blocks of data.
          > cside30> for example, a variable named, $abendstatus, will have a
          value of
          > cside30> "Ended Not OK" as data.
          >
          > cside30> How do I parse this data into 3 different variables to show as
          >
          > cside30> $line1 = ended
          > cside30> $line2 = Not
          > cside30> $line3 = OK
          >
          > You don't want three different variables. Hint: any variable that
          ends in a
          > sequence, like "1" "2" "3" or "a" "b" "c" means you should have put that
          > information into a data structure instead.
          >
          > You might want:
          >
          > $data = "Ended Not OK";
          > @words = split ' ', $data;
          >
          > now $words[0] is "Ended", and so on.
          >
          > --
          > 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!
          >
        • Bora Uyar
          if you want, you can download from http: students.sabanciuniv.edu ~borauyar perl perlbooks.zip ... [Non-text portions of this message have been removed]
          Message 4 of 6 , Dec 12, 2007
            if you want, you can download from
            http:\\students.sabanciuniv.edu\~borauyar\perl\perlbooks.zip

            cside30 wrote:
            >
            > WOW...
            >
            > Thanks...
            >
            > Can you recommend a book or an online book where I can educate myself
            > more on that command?? I was looking online on Perl.org is that a good
            > website??
            >
            > --- In perl-beginner@yahoogroups.com
            > <mailto:perl-beginner%40yahoogroups.com>, merlyn@... wrote:
            > >
            > > >>>>> "cside30" == cside30 <kpatters@...> writes:
            > >
            > > cside30> Hello,
            > > cside30> I am a newbie to perl.
            > >
            > > cside30> I am getting data from an arg with multiple blocks of data.
            > > cside30> for example, a variable named, $abendstatus, will have a
            > value of
            > > cside30> "Ended Not OK" as data.
            > >
            > > cside30> How do I parse this data into 3 different variables to show as
            > >
            > > cside30> $line1 = ended
            > > cside30> $line2 = Not
            > > cside30> $line3 = OK
            > >
            > > You don't want three different variables. Hint: any variable that
            > ends in a
            > > sequence, like "1" "2" "3" or "a" "b" "c" means you should have put that
            > > information into a data structure instead.
            > >
            > > You might want:
            > >
            > > $data = "Ended Not OK";
            > > @words = split ' ', $data;
            > >
            > > now $words[0] is "Ended", and so on.
            > >
            > > --
            > > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
            > 777 0095
            > > <merlyn@...> <URL:http://www.stonehenge.com/merlyn/
            > <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!
            > >
            >
            >


            [Non-text portions of this message have been removed]
          • merlyn@stonehenge.com
            ... cside30 Can you recommend a book or an online book where I can educate myself cside30 more on that command?? I was looking online on Perl.org is that a
            Message 5 of 6 , Dec 12, 2007
              >>>>> "cside30" == cside30 <kpatters@...> writes:

              cside30> Can you recommend a book or an online book where I can educate myself
              cside30> more on that command?? I was looking online on Perl.org is that a good
              cside30> website??

              learn.perl.org.

              But I love the leading line... so let me use it.

              "Why yes, please check out 'Learning Perl', which does what it says
              in the title!"

              Of course, that's my book. :)

              --
              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!
            • merlyn@stonehenge.com
              ... Bora if you want, you can download from Bora http: students.sabanciuniv.edu ~borauyar [REDACTED] First, that s not a real URL. Your slashes are leaning
              Message 6 of 6 , Dec 17, 2007
                >>>>> "Bora" == Bora Uyar <borauyar@...> writes:

                Bora> if you want, you can download from
                Bora> http:\\students.sabanciuniv.edu\~borauyar [REDACTED]

                First, that's not a real URL. Your slashes are leaning the wrong way.

                Second, I find your posting highly offensive. Those are ILLEGAL
                copies of MY books.

                Don't be a pirate. People worked hard to bring you those books,
                and you spit in their face.

                Please remove that archive.

                I've also sent a note to O'Reilly legal. Your university will likely be
                contacted with a takedown notice. I presume they have a policy for dealing
                with piracy.

                --
                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!
              Your message has been successfully submitted and would be delivered to recipients shortly.