On Thu, Mar 29, 2012 at 6:08 PM, John W. Krahn wrote:
> my wrote:
>>
>> The goal of this assignment is to put in practice the list and I/O
>> functionalities implemented by Perl.
>>
>>
>>
>> Write a program that will read a list from a file (input), will sort
>> the list in lexical order and write
#!/usr/bin/env perl
use strict;
use warnings;
use autodie qw(open close);
use 5.012;
open my $fh, '<', '/etc/passwd';
open my $fh2, '>', '/tmp/newpasswd';
my $uid;
my %h;
while(<$fh>){
$uid = (split /\:/, $_)[0];
$h{$uid} = $_;
}
print $fh2 map "$h{$_}", sort keys %h;
my wrote:
The goal of this assignment is to put in practice the list and I/O
functionalities implemented by Perl.
Write a program that will read a list from a file (input), will sort
the list in lexical order and write back the sorted list to another
file (output). You can use arrays and any