[Chicago-talk] string operator question.

Richard Reina richard at rushlogistics.com
Sat Sep 12 06:37:13 PDT 2009

I have a program that reads each line of a file.  The last line of the file may contain a number. I am trying to find a way to isolate the number within that line to give it value so it is a number and only a number and not a line of the file.

I can do:

$number = $_;   # lets say the number is 83848;
print $number;

and print number gives me:


However when I try to do something with this number like pass it along to an external subroutine with process_number($number) The subroutine can't interpret it.

Do I need to strip the number down some how? I tried to play with chomp() with no luck.  Any help would be greatly appreciated as solving this would allow me to spend some time with my wife and kids.

More information about the Chicago-talk mailing list