in reply to printing array and string on same line

That should work fine. You probably want to use \n rather than /n in your strings but I don't see anything that would break it. What problem are you having with it exactly?

One caveat: I'm not sure how to do it on win (^Z, I think) but you'd need to type an end of file after you enter your list in (one element to a line.)

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: printing array and string on same line

Replies are listed 'Best First'.
Re: Re: printing array and string on same line
by BigRare (Pilgrim) on Jun 11, 2003 at 00:28 UTC
    Whoops, I am using \n rather than /n. Haha. Long day.

    What happens is that nothing prints. Odly enough if I don't chomp the array, it prints: was: $list[$number-1] with the correct values, but nothing else in the print statement.

    Update: Fixed tags in post.

      That sounds like you are chopping $number rather than chomping, and getting the carriage return printed after the number without the linefeed.

      In any case, to get it to print, it sounds like you might need to put a newline ("\n") on the end of your final print. (I say that because you are at least getting something if you don't chomp the array...)

      -sauoq
      "My two cents aren't worth a dime.";
      
        Well, thank you very much for the help. I tried it again from home and it works if I don't chomp the array, but it prints nothing if I chomp the array. Now that I've had a break from thinking, it works.

        Thanks very much for the suggestions. A newline would be of better use on the beginning of the final print as it would move everything down a line, but placing one on the end, I don't think, would do much.

        And since I started writing this, it now doesn't print anything. Interesting, it works on a fresh boot, but not after running a few times. Must be something on my computer. This never happens on my linux box. :o) Thanks again for your help.