in reply to Re^4: Not able to ParseDate lines from a file
in thread Not able to ParseDate lines from a file

"it gives me the desired result". Could you be more specific. What was the value of $year. Note that perl does automatic conversion between string and integer value. There is no need for the int() function. If it really is a number you can use it as a number

Do you still get the error about "undef". In that case you should use something like this to test your script:

use Data::Dumper; $Data::Dumper::Useqq=1; print Dumper($year);

This will print out $year as if you had written it in your script as a constant value. If anything strange is happening, for example your $year is a reference or has unprintable control characters in it, this will show it.

PS: int(undef) will be 0, so whatever you are seeing is expected if $year is really undef. You may have a typo in the variable name (which should give an error if you have "use strict" on)