Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: storage of numbers

by BillKSmith (Chaplain)
on Oct 17, 2013 at 02:53 UTC ( #1058585=note: print w/ replies, xml ) Need Help??


in reply to Re: storage of numbers
in thread storage of numbers

Laurent, use strict; would have caught your typo. I prefer to get the special cases out of the way early.

use strict; use warnings; my ($min, $max) = (0, 0); while(<DATA>){ chomp( my $input = $_ ); last if $input eq ''; $min = $input if $input < $min; $max = $input if $input > $max; } print "Min and Max are : $min $max \n"; __DATA__ 11 13 56 75 53 68 89 22
Bill


Comment on Re^2: storage of numbers
Select or Download Code
Re^3: storage of numbers
by Laurent_R (Parson) on Oct 17, 2013 at 17:12 UTC

    Laurent, use strict; would have caught your typo.

    Not really, Bill, since I did not try to run or even to compile the code. In my view, this was just a small code snippet showing changes compared to the original program, not a full program. But sure, I always use strict and warnings when I write actual programs. Thanks you for mentioning the typo.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-12-27 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls