>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:

  SB> The only reason I knew that int() worked properly in the OP's case is
  SB> due to a prior (ie not long after my first exposure to Perl) experience
  SB> where I had to supply a date to a sub in a program I didn't write.

but we still don't know what the OP's code actually did and why he was
seeing those warnings. you can't get them given what he said and int is
not a solution to a problem which may not exist. where did those numbers
with leading 0's come from? why are the 0's being deleted (for no reason
in normal perl IMO).

  SB> This was in the day when each function that dealt with dates would have
  SB> it's own code to format it. In the particular case I am referring to,
  SB> the date had to be supplied in dd-mm-yyyy format, but if any one of
  SB> dd|mm was <=9, only a single digit was acceptable (so I was told).

  SB> So at that time, I found int() to do the job quite well, and serve as a
  SB> good reminder when I reviewed the code that I was doing a form of a
  SB> typecast.

but 2 digit months or days are a known format to keep things aligned and
easily sorted with string (vs numeric or more complex) sorts.

  SB> I could have also used s/0//, but I knew no better then.

there are many ways to do that in many different contexts. again,
without real code this is all speculation which is what annoys me. his
claim still makes no sense given the meager information we have been
given. there is no octal number in perl, just octal strings that can be
converted to or from perl numbers.

  SB> Thanks for the tip regarding what int was originally designed for. I
  SB> didn't know that.

int isn't a fix for anything. it is a core function that is very useful
in context and found in many languages.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to