[EMAIL PROTECTED] wrote:
> Let me add that instead of an an-close-as-possible translation
> from the original Perl code, one can rewrite this as:
>
def bcdlen(length):
> ... strlen = "%04s" % length
> ... return chr(int(strlen[2:4], 16)) + chr(int(strlen[0:2], 16))
>
>
> which is
On Jun 26, 8:59 am, [EMAIL PROTECTED] wrote:
(snipped)
>
> >>> def bcdlen(*args):
>
> ... strlen = "%04s" % str(args[0])
> ... firstval = int(strlen[2:3]) * 16 + int(strlen[3:4])
> ... lastval = int(strlen[0:1]) * 16 + int(strlen[1:2])
> ... return "%s%s" % (chr(firstval), chr(la
On Tue, Jun 26, 2007 at 08:17:06AM -0700, vj wrote:
>I posted too soon:
>
>> Statement 1:
>> my $today = sprintf("%4s%02s%02s", [localtime()]->[5]+1900,
>> [localtime()]->[4]+1, [localtime()]->[3]) ;
>
>1. is localtime the same as time in python?
You could use this instead
-
from time import loc
On Jun 26, 8:04 am, vj <[EMAIL PROTECTED]> wrote:
> I have a perl script which connect to network stream using sockets.
> The scripts first logins in to the server and then parses the data
> comming from the socket.
>
> Statement 1:
> my $today = sprintf("%4s%02s%02s", [localtime()]->[5]+1900,
>
vj wrote:
> I posted too soon:
>
>> Statement 1:
>> my $today = sprintf("%4s%02s%02s", [localtime()]->[5]+1900,
>> [localtime()]->[4]+1, [localtime()]->[3]) ;
>
> 1. is localtime the same as time in python?
http://perldoc.perl.org/functions/localtime.html
It's more like time.localtime()
One
I posted too soon:
> Statement 1:
> my $today = sprintf("%4s%02s%02s", [localtime()]->[5]+1900,
> [localtime()]->[4]+1, [localtime()]->[3]) ;
1. is localtime the same as time in python?
2. What does -> ? do in perl?
3. What is 'my'
> Statement 2:
> my $password = md5_hex("$today$username") ;