in reply to Odd warning

As a note, you're using abs, but the specification doesn't allow for minus signs. \d contains only digits 0-9 and nothing else. Maybe you want to widen your spec to ([0-9\-\.]{5}) or something similar.

On some test data that I made up, I didn't get any warnings. Maybe you have something that would help, something more specific? As it is, it doesn't seem like you should be getting any warnings, but you may be using an antiquated perl which might not work like the 5.6.1 that I tested on.

Replies are listed 'Best First'.
Re: Re: Odd warning
by Melly (Chaplain) on Jul 25, 2002 at 16:31 UTC

    The abs $2 is to chop off any leading 0's (00012 to 12 for example). Probably not the approved method, butwhatthehell.

    Haven't really got any additional info. on the problem. I'm basically going through a large data file, and each line starts with a numeric. Everything goes fine, but then suddenly I'll get a crop of warnings, then fine again, then warnings.

    It doesn't really make any sense to me, and I wonder if the problem is elsewhere in my code and being misreported.

    Still, apart from that, I get no warnings, so I guess I'll turn 'em off.

    Oh, perl 5.6.0 under win2000.

    Tom Melly, tom@tomandlu.co.uk

      Melly wrote: The abs $2 is to chop off any leading 0's (00012 to 12 for example).

      If you run into this frequently, you can just add zero to the string to force a numeric context and eliminate those zeroes.

      perl -e '$foo="007";print "$foo\n";$foo+=0;print "$foo\n"' 007 7

      Cheers,
      Ovid

      Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.