c: [EMAIL PROTECTED]
> Subject: RE: Adding/Multiplying binary numbers in Perl
>
>
> Thanks. I got the binary numbers correctly and when I try to write that
> number in it's binary format to a file using binmode(FILEHANDLE) it still
> writes the character format instead of binary f
No one has mentioned this yet, but Bit::Vector is *made* to
do things like add and multiply bit strings. [And a whole
lot more, too.] Plus, the underlying functions are in C and
really fast.
Try this little one-liner using Bit::Vector to print out
all the primes between 1 and the number you pu
TED]>
To: "'Toby Stuart'"<[EMAIL PROTECTED]>, "'Mark'"<[EMAIL PROTECTED]>
Cc:
"'[EMAIL PROTECTED]'"<[EMAIL PROTECTED]>
Date: Wed May 09 03:18:00 PDT 2001
Subject: Re: Numbers in perl
>Toby Stuart wrote:
>>
]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Peter Eisengrein
Sent: Tuesday, May 08, 2001 12:05 PM
To: 'Perl_Users'
Subject: RE: Numbers in perl
But isn't sprintf %1.1f just rounding the numbers anyway, thus continuing
the approximation? Why wouldn't perl (or the OS for that matter) mul
Toby Stuart wrote:
> return undef if length($n) != 9; #assuming an SSN is
> always 9 chars
I would s/return undef/return/ here, since return without an argument does
"the right thing" regardless of whether the sub was called in scalar or list
context.
> $n =~ m/^(\d{3})(\d{2})(\d{4}
$Bill Luebkert wrote:
> You could use substr or a pattern match or ??. substr is
> probably faster than RE.
And unpack possibly clearer.
Cheers,
Philip
--
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the preci
001 04:05 PM
> To: Lee Goddard; Ron Hartikka; perl win32 users
> Subject: Re: Re: Numbers in perl
>
> Guys,
> I have a question kind of along these lines. If I have a number,
"string",
> that I extract from the dB using DBI and CGI.pm like 455368900 (ssn)
which
> I am
Kevin Plyler wrote:
> I have a question kind of along these lines. If I have a
> number, "string", that I extract from the dB using DBI and
> CGI.pm like 455368900 (ssn) which I am using as a unique
> identifier but also need to display on a report. And need to
> insert the dashes xxx-xx-
Here is one (of many) ways to do it:
$ssn = "455368900";
(my $disp = $ssn) =~ s/(...)(..)()/$1-$2-$3/;
print $disp;
Mark wrote:
>
> Guys,
> I have a question kind of along these lines. If I have a number, "string", that I
>extract from the dB using DBI and CGI.pm like 455368900 (ssn) which
Mark wrote:
>
> Guys,
> I have a question kind of along these lines. If I have a number, "string", that I
>extract from the dB using DBI and CGI.pm like 455368900 (ssn) which I am using as a
>unique identifier but also need to display on a report. And need to insert the dashes
>xxx-xx- to
turn $1 . "-" . $2 . "-" . $3
}
hth
t0by
> -Original Message-
> From: Mark [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, May 09, 2001 9:05 AM
> To: Lee Goddard; Ron Hartikka; perl win32 users
> Subject: Re: Re: Numbers in perl
>
> Guys,
>
;Ron Hartikka"<[EMAIL PROTECTED]>, "perl win32
users"<[EMAIL PROTECTED]>
Date: Tue May 08 08:25:15 PDT 2001
Subject: Re: Numbers in perl
>Thanks, got there too: re-assignment
>
>Thanks again,
>lee
>
>> -Original Message-
>> From: [E
12 matches
Mail list logo