Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
$line=~/(\w+),(\w+),(\d+),(\d+),(\d+)/; And what happens when the regex doesn't match? don't use $1, $2, ... withouth checking that. An alternative appraoch:
This has the advantage that you can have an arbitrary number of marks. Of course you'll need to adjust the rest of the code a bit, for example;
So $status is the status of the last mark only. Is that what you want? You should test your script also with data of failing students. BTW I strongly recommend to align the code better, one tab for each opening brace. In reply to Re: Students Rank calculation for the below perl script
by moritz
|
|