NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
Re: split and compare
by pzbagel (Chaplain) on May 20, 2003 at 16:22 UTC
    Let's go line by line:
    # Splits the contents of $16 on commas into array @_1 @_1= split "\,",$16; # If @_1 has only one element force $time to integer # Does $time already have a value? That's not apparent in # this snippet. if($#_1 eq 0){ $time = int ($time); } # If @_1 has two elements set $time to the first one # remove any commas (Although those should have been taken # care of by the split above) # And multiply $time by 1000 if($#_1 eq 1){ $time=$_1[0]; $time=~ s/\,//g; $time*=1000; } # If @_1 has 2 or 3 elements simply set $time to 1000 if($#_1 eq 2){ $time=1000;} if($#_1 eq 3){$time=1000;}

    This code seems like it is splitting up a large number with commas in it a la 1,000,000,000 or something. Perhaps Number::Format could be used?

    HTH