Thank you Randal. Yes, the formula looked ugly and the challenge from
'The Camel' on p.119, 120
prompted me to post for the Perl idiom to do the job. Jay's posting
weaved the magic after some modifications.
Hard to believe that such a terse coding using only hashes can do the job
for the 30,000 r
> "Alfred" == Alfred Vahau <[EMAIL PROTECTED]> writes:
Alfred> $wcp = ($a6*4.0*6.0 + $a4*4.0*4.0 + $a3*4.0*3.0 + $a2*4.0*2.0) +
Alfred> ($b6*3.0*6.0 + $b4*3.0*4.0 + $b3*3.0*3.0 + $b2*3.0*2.0) +
Alfred> ($c6*2.0*6.0 + $c4*2.0*4.0 + $c3*2.0*3.0 + $c2*2.0*2.0) +
Alfred>
Jay wrote:
On Thu, 17 Feb 2005 06:06:30 +1000, Alfred Vahau <[EMAIL PROTECTED]> wrote:
$inputfile = 'gpa.dat';
open (INF, "<$inputfile") || die "can't open file $inputfile $!:\n";
But this is another problem that I can address later.
*
my $inputfile = 'gpa.dat' ;
strict wants you t
On Thu, 17 Feb 2005 06:06:30 +1000, Alfred Vahau <[EMAIL PROTECTED]> wrote:
>
> $inputfile = 'gpa.dat';
> open (INF, "<$inputfile") || die "can't open file $inputfile $!:\n";
>
> But this is another problem that I can address later.
> *
>
my $inputfile = 'gpa.dat' ;
strict wants you to
Jay wrote:
On Thu, 17 Feb 2005 00:52:48 +1000, Alfred Vahau <[EMAIL PROTECTED]> wrote:
Hi,
I've been struggling with what should be a trivial problem. Perl is such
a rich language that in formulating the logic, I've actually
became confused. Partly because I took a C approach when I know that a
Thank you for the pointer. I will check the calculation again for GPA of
1.98 against id 216.
Clearly there is no problem for allowed grades so 1.40 has been
confirmed for 386.
Alfred,
Ankur Gupta wrote:
#!/usr/bin/perl
# This is the GPA calculation routine for the
# Eduadmin system again.
On Wed, 16 Feb 2005 11:10:24 -0500, Jay <[EMAIL PROTECTED]> wrote:
> On Thu, 17 Feb 2005 00:52:48 +1000, Alfred Vahau <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I've been struggling with what should be a trivial problem. Perl is such
> > a rich language that in formulating the logic, I've actually
> >
On Thu, 17 Feb 2005 00:52:48 +1000, Alfred Vahau <[EMAIL PROTECTED]> wrote:
> Hi,
> I've been struggling with what should be a trivial problem. Perl is such
> a rich language that in formulating the logic, I've actually
> became confused. Partly because I took a C approach when I know that a
> vete
#!/usr/bin/perl
# This is the GPA calculation routine for the
# Eduadmin system again.
#
$ifile = 'gpa.dat';
open (INF, "<$ifile") || die "Can't open file $ifile:$!\n";
$cp_total = 0;
$id = 0;
$temp = 0;
LINE: while () { ($id, $grade, $cp) =
split;
if (
Hi,
I've been struggling with what should be a trivial problem. Perl is such
a rich language that in formulating the logic, I've actually
became confused. Partly because I took a C approach when I know that a
veteran Perl programmer would write only a few lines to achive the same
result. (The ch
10 matches
Mail list logo