xpl0it:
So what problem are you having? You're not giving complete information, so all I can do is guess. But now you know that the year is incorrect, so that should give you a start.
You should play around and figure out how scalars work in perl. If you take a string and treat it like a number, it will automatically convert to a number. The int function simply chops off the fractional chunk of a number. Consider:
Roboticus@Roboticus-PC ~
$ cat foo.pl
#!/usr/bin/perl
use strict;
use warnings;
for my $str ('AD 1650', '16.50', '1650') {
my $num = $str + 0; # Convert to a number
my $int = int($num); # Convert to an int
print "string=$str, number=$num, integer=$int.\n";
}
Roboticus@Roboticus-PC ~
$ perl foo.pl
Argument "AD 1650" isn't numeric in addition (+) at foo.pl line 6.
string=AD 1650, number=0, integer=0.
string=16.50, number=16.5, integer=16.
string=1650, number=1650, integer=1650.
I don't know if I told you too much or too little, as you don't give enough context about your problem to be certain.
...roboticus
When your only tool is a hammer, all problems look like your thumb. |