RE: Adding/Multiplying binary numbers in Perl

2002-06-05 Thread Carl Jolley
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

Re: Adding/Multiplying binary numbers in Perl

2002-06-02 Thread Cassell . David
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

Re: Re: Numbers in perl

2001-05-09 Thread Mark
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: >>

RE: Numbers in perl

2001-05-09 Thread Ron Hartikka
] [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

Re: Numbers in perl

2001-05-09 Thread Philip Newton
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}

Re: Numbers in perl

2001-05-09 Thread Philip Newton
$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

RE: Re: Numbers in perl

2001-05-09 Thread Justin Rogers
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

Re: Numbers in perl

2001-05-09 Thread Philip Newton
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-

Re: Numbers in perl

2001-05-09 Thread Jon Bjornstad
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

Re: Numbers in perl

2001-05-09 Thread $Bill Luebkert
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

RE: Re: Numbers in perl

2001-05-09 Thread Toby Stuart
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, >

Re: Re: Numbers in perl

2001-05-08 Thread Mark
;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