foreach ($a, $b, $c)...

Discussion in 'Perl Misc' started by Ken Sington, Jun 13, 2004.

  1. Ken Sington

    Ken Sington Guest

    has anyone tried:

    foreach ($a, $b, $c){
    ...
    }

    well, it doesn't work.

    but what if I wanted to do that?
     
    Ken Sington, Jun 13, 2004
    #1
    1. Advertising

  2. Ken Sington

    Sam Holden Guest

    On Sat, 12 Jun 2004 20:52:49 -0400,
    Ken Sington <ken_sington@nospam_abcdefg.com> wrote:
    > has anyone tried:
    >
    > foreach ($a, $b, $c){
    > ...
    > }
    >
    > well, it doesn't work.


    It does work just fine, as long as your replace '...' with some valid
    perl syntax.

    "It doesn't work" isn't a useful problem description, especially when it
    does in fact "work".

    > but what if I wanted to do that?


    Then you do it.

    --
    Sam Holden
     
    Sam Holden, Jun 13, 2004
    #2
    1. Advertising

  3. Ken Sington

    Xaonon Guest

    Ned i bach <>, Ken Sington
    <ken_sington@nospam_abcdefg.com> teithant i thiw hin:

    > has anyone tried:
    >
    > foreach ($a, $b, $c){
    > ...
    > }
    >
    > well, it doesn't work.


    My, what a specific description of the problem. It "works" fine for me,
    assuming the variables had already been defined.

    --
    Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
    http://xaonon.dyndns.org/ Guaranteed content-free since 1999. No refunds.
    "Accepting that identity is relative means two things: that immortality is
    impossible, and that immortality is inevitable." -- Eric Zetterbaum
     
    Xaonon, Jun 13, 2004
    #3
  4. Ken Sington

    ChrisO Guest

    Ken Sington wrote:
    > has anyone tried:
    >
    > foreach ($a, $b, $c){
    > ...
    > }
    >
    > well, it doesn't work.
    >
    > but what if I wanted to do that?


    Dude, what does "doesn't work" MEAN? Provide an EXAMPLE. It DOES work
    if you do it right:

    $ perl -e '$a = "This"; $b = "DOES"; $c = "work!"; for ($a, $b, $c) {
    print "$_ \n" }'
    This
    DOES
    work!

    -ceo
     
    ChrisO, Jun 13, 2004
    #4
  5. Ken Sington <ken_sington@nospam_abcdefg.com> wrote:
    > has anyone tried:
    >
    > foreach ($a, $b, $c){
    > ...
    > }
    >
    > well, it doesn't work.



    You are the only person who knows what "doesn't work" means when
    you say it.

    One or more other people must know what you mean when you say it
    if they are to be able to help you understand, fix or change it...


    You have not given us enough information to get an answer.

    Have you seen the Posting Guidelines that are posted here frequently?



    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jun 13, 2004
    #5
  6. Ken Sington wrote:
    > has anyone tried:


    I'm sure many people have

    > foreach ($a, $b, $c){
    > ...
    > }
    >
    > well, it doesn't work.


    Please define "doesn't work".
    - What did you expect it to do?
    - What actual behaviour did you observe?
    - In which way was the observed behaviour different from the expected
    behaviour?

    > but what if I wanted to do that?


    Please define "that". What did you expect this code fragment to do?

    jue
     
    Jürgen Exner, Jun 13, 2004
    #6
  7. Ken Sington

    Ken Sington Guest

    folks are too kind.
    yeah, i read the guide lines.

    I thought I was asking the right q. guess not.

    well, the problem was solved.
    I was just playing around with foreach loops.

    but thanks folks.

    great hobby, that PERL.
     
    Ken Sington, Jun 14, 2004
    #7
  8. Ken Sington

    Uri Guttman Guest

    >>>>> "KS" == Ken Sington <ken_sington@nospam_abcdefg.com> writes:

    KS> folks are too kind.
    KS> yeah, i read the guide lines.

    KS> I thought I was asking the right q. guess not.

    you asked the right question but with too little information. do you see
    the difference? and as many have said, the phrase 'doesn't work' all by
    itself is useless and carries no information. context is all.

    KS> well, the problem was solved.
    KS> I was just playing around with foreach loops.

    and you never showed what the real problem was nor your 'solution'

    KS> but thanks folks.

    KS> great hobby, that PERL.

    then pick up another hobby like juggling swiss army chainsaws. if you
    want help and are asked for more information, you are supposed to give
    it.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
     
    Uri Guttman, Jun 14, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: foreach loop error

    Kevin Spencer, Aug 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    366
    Kevin Spencer
    Aug 22, 2003
  2. Luc Kumps

    Re: foreach loop error

    Luc Kumps, Aug 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    385
    Luc Kumps
    Aug 22, 2003
  3. =?Utf-8?B?SnVzdGlu?=

    Problem with foreach loop

    =?Utf-8?B?SnVzdGlu?=, Oct 22, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    328
    Hans Kesting
    Oct 22, 2004
  4. Islam Elkhayat

    loop througth Literials using foreach!!

    Islam Elkhayat, Feb 10, 2005, in forum: ASP .Net
    Replies:
    16
    Views:
    759
    Scott Allen
    Feb 12, 2005
  5. caldera
    Replies:
    1
    Views:
    4,413
    Scott Allen
    Feb 22, 2005
Loading...

Share This Page