Hi Anthony >"Anthony Beaman" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >Hi! I'm still wallowing in Chapter 3 (Arrays. Why can't I get it?!?!?!? ARGH!!!!!) of Learning Perl on >Win32 Systems. I'm trying to create an exercise but I'm not getting the results that I want. Here's what I'm >trying to do: > >I'm asking for a list of names: > > print "Name your friends: "; > @names = <STDIN>; >
looks okay >Then I want to pretend that I know the one of the friends. In this case, I'll choose the 2nd one and here's >where I'm not getting what I want: > > print "I know $names[1].\n"; looks okay too. You must be doing something that you've not posted here. Is your print immediately after your stdin? Has your array gone out of scope. The following is what you're trying to do, and works on my machince #!/perl -w use strict; my @names; @names = <STDIN>; print "I know $names[1].\n"; > >The output shows "I know ." > >Isn't "$names[whatever]" what I'm supposed to use to get an element of the array? I've tried this with >numbers and have gotten the same results. What am I doing wrong? Thanks! :-) Post more of your prog if us still doesn't work HTH Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]