I thought about that and I understand how that works, however the piece that I 
am missing and don't understand is how to access each element of the array, 
reverse the data and put the comma in.  I know how to access the elements, it 
is the manipulating and putting back into the array for further processing 
that I am confused on.

Thanks


On Friday 20 September 2002 08:06 pm, Timothy Johnson wrote:
> I'll give you a hint.  This is perfectly legal:
>
> my @array = <STDIN>;
>
> Let me know if you still can't figure it out.
>
> -----Original Message-----
> From: Grant Hansen [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 6:03 PM
> To: [EMAIL PROTECTED]
> Subject: Help on Arrays - Beginner
>
>
> Hello All,
>
> I am new to Perl and I will admit up front this is for a Perl course.
> However, the course is online and thus timely communication from the
> instructor is not always possible, so I am hoping someone will steer me in
> the right direction.
>
> The assignment has to do with taking a file, and reading it to <STDIN>,
> modifying each line, sort and then print.
>
> Here is the Input:
>
> Grant Hansen
> Dave Thomas
> Roger Starbauch
>
> Here is the intended output:
>
> Hansen, Grant
> Starbauch, Roger
> Thomas, Dave
>
> Here is my code:
>
> while(<STDIN>) {
>      chomp(@lines = split);
>      @lines1 = $lines[1] . ", " .  $lines[0];
>      @lines2 = sort (@lines1);
>      print "@lines2 \n";
> }
>
> My code is not sorting correctly and I know why (I sort after each line of
> input), I just don't know how to fix it.
>
> Any help is appreciated.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to