[ create a new paste ] login | about

Link: http://codepad.org/kGhrStTt    [ raw code | output | fork ]

sironekotoro - Perl, pasted on Sep 23:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env perl
use strict;
use warnings;

my $answer = 25;
my $var = <STDIN>;
chomp $var;

if ($var == $answer){
    print "OK\n";
}elsif($var < $answer ){
    print "too small\n";
    if ($answer -$var <= 5){
        print "near\n";
    }
}elsif($var > $answer ){
    print "too big\n";
    if ($var -$answer <= 5 ){
    print "near\n";
    }
}


Output:
1
2
3
4
5
Use of uninitialized value in scalar chomp at t.pl line 7.
Use of uninitialized value in numeric eq (==) at t.pl line 9.
Use of uninitialized value in numeric lt (<) at t.pl line 9.
too small
Use of uninitialized value in subtraction (-) at t.pl line 13.


Create a new paste based on this one


Comments: