Hi! I'm on Windows 98 at the moment (at work) but I'll try this on my NT machine when I get home. Here's what I got when I ran your script:
C:\>perl hello.pl Joe Mary Sue Use of uninitialized value in concatenation (.) at hello.pl line 5, <STDIN> line 1. I know . Got an error but then I got the same results that I've been getting ("I know ."). -----Original Message----- From: Rob Anderson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 9:12 AM To: [EMAIL PROTECTED] Subject: Re: Array Question 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]