keltan has asked for the wisdom of the Perl Monks concerning the following question:
2.John, Kowalski, 34267 Eve, Nowak, 11232 Theodor, McNack, 3423
What do i need to do is:11232, 5.0 55342, 2.0 3423, 3.5
As you can see in first text file i've got students with their numbers and in the second one i've got grades and numbers. What i need to do is sth like this:Exam results: 1. Eve Nowak 5.0 2. Theodor McNack 3.5 absent: 1. John Kowalski unidentified: 1. 55342
I've written so far this code but i really don't know how to solve this task.#!/usr/bin/perl -w $students = $ARGV[0]; $results = $ARGV[1]; open my $fh, '<', $students; while(<$fh>) { @def = split /,/, $_; chomp(@def1); print "@def"; } open my $fg, '<', $results; while(<$fg>){ @def1=split /,/,$_; chomp(@def1); print "@def1"; } close($fg); close($fh);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 2 txt files comparison and sorting
by CountZero (Bishop) on Apr 20, 2015 at 19:57 UTC | |
|
Re: 2 txt files comparison and sorting
by NetWallah (Canon) on Apr 20, 2015 at 18:37 UTC | |
|
Re: 2 txt files comparison and sorting
by toolic (Bishop) on Apr 20, 2015 at 18:38 UTC |