Re: Incorrect handling of very small doubles?

2010-09-20 Thread Jon Hermansen
Hi Abu, This code works for me: #!/usr/bin/perl my $d1, $d2, $sum; $d1 = 6.892964 * 10 ** -309; $d2 = 1.102874 * 10 ** -307; $sum = $d1 + $d2; printf("d1 = %e\n", $d1); printf("d2 = %e\n", $d2); printf("sum = %e\n", $sum); On Mon, Sep 20, 2010 at 1:30 PM, Abu Yoav wrote: > Hi, > > I wanted

Experience with GSM::ENCODE

2010-09-20 Thread Kwaku Addo Ofori
Hi, Does anyone have some experience with the perl Encode::GSM0338 module. I need to encode some utf8 content (predominantly french characters) I fetch from a mysql database and then encode them to the corresponding gsm character set. Without doing this the content is not rendered properly on the

Re: How to determine web user's location

2010-09-20 Thread Ask Bjørn Hansen
On 9/15/10 14:37, Mimi Cafe wrote: I just found few cpan modules (Geo::IP2Location, Geo::IP) which both use flat file databases to lookup country an IP is originating from, but I yet to understand how the originating city can be determined. Any other suggestions? Maxmind (who makes the databas

Incorrect handling of very small doubles?

2010-09-20 Thread Abu Yoav
Hi, I wanted to port a small c program to perl. However, the two programs behave differently with respect to very small "double" values. The behavior seems like a bug to me, but since I'm very new to perl, I thought I might ask the list first. Relevant code and output follows. Thanks! --- c code

Re: One query

2010-09-20 Thread Dr.Ruud
On 2010-09-20 14:16, wrote: while(){ Use of a File Handle in this case would be better my ($key, $value) = split (/\t/,$_); and Use "\s+" instead of "\t" . And even better, use the special ' '. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands,

Re: One query

2010-09-20 Thread Whacky™
> while(){ Use of a File Handle in this case would be better >   my ($key, $value) = split (/\t/,$_); and Use "\s+" instead of "\t" . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: What does -w means in #!/usr/bin/perl -w

2010-09-20 Thread Shawn H Corey
On 10-09-20 03:21 AM, Kammen van, Marco, Springer SBM NL wrote: -Original Message- From: rahul patil [mailto:rahul.deshmukhpa...@gmail.com] Sent: Monday, September 20, 2010 8:59 AM To: beginners@perl.org Subject: What does -w means in #!/usr/bin/perl -w Hello all, I use linux. whe

Re: current record number with if statement

2010-09-20 Thread Shlomi Fish
On Monday 20 September 2010 12:30:55 Raj wrote: > Hi, > > I am a newbie for perl. > > It would be fine if some explain how the following code prints first > 10 lines of the file. > My question here is, how/what if condition match happens? Is there > anything related to current record number ($.

current record number with if statement

2010-09-20 Thread Raj
Hi, I am a newbie for perl. It would be fine if some explain how the following code prints first 10 lines of the file. My question here is, how/what if condition match happens? Is there anything related to current record number ($.) variable? while () { print if 1 .. 10; } Regards, Raj

Re: one query

2010-09-20 Thread Shlomi Fish
Hi Jordi, On Monday 20 September 2010 10:16:40 Jordi Durban wrote: > Hi all! > I have a file like this : > > colum acolum b > uid = 1 uid = 4 > uid = 2 uid = 3 > uid = 3 uid = 2 > uid = 4 uid = 1 > > I'm trying to find those columns with the same numbers

Re: how to concatenate two lists

2010-09-20 Thread Shlomi Fish
On Monday 20 September 2010 09:49:27 rahul patil wrote: > Hello all, > > below is sample code i have written.Is it right way to declare ar4 which is > concatenation of ar and ar1 > > #!/usr/bin/perl > @ar = {"rahul","patil"}; You shouldn't use { ... } for arrays (this is not C). Use: my @ar = (

Re: how to concatenate two lists

2010-09-20 Thread Uri Guttman
> "PK" == Parag Kalra writes: PK> #!/usr/bin/perl PK> use strict; PK> use warnings; PK> my @ar = ("rahul","patil"); PK> my @ar1 = ("nitin"); PK> my @ar4; PK> push @ar4, (@ar, @ar1); PK> print "@ar4"; it is nice that you are trying to help but your code can be better. there is

one query

2010-09-20 Thread Jordi Durban
Hi all! I have a file like this : colum acolum b uid = 1 uid = 4 uid = 2 uid = 3 uid = 3 uid = 2 uid = 4 uid = 1 I'm trying to find those columns with the same numbers regardless the colum they are. That's, in the example, the row 2 is identital to row 3.

Re: how to concatenate two lists

2010-09-20 Thread rahul patil
On Mon, Sep 20, 2010 at 1:30 PM, Chaitanya Yanamadala < dr.virus.in...@gmail.com> wrote: > @ar = ("rahul","patil"); > @ar1 = ("nitin"); > @ar4 = (@ar,@ar1); > > the only problem is u should not define the array with this { } it should > be defined within this brackets (); > > Chaitanya > > This wo

Re: how to concatenate two lists

2010-09-20 Thread Chaitanya Yanamadala
@ar = ("rahul","patil"); @ar1 = ("nitin"); @ar4 = (@ar,@ar1); the only problem is u should not define the array with this { } it should be defined within this brackets (); Chaitanya On Mon, Sep 20, 2010 at 1:19 PM, rahul patil wrote: > Hello all, > > below is sample code i have written.Is it

Re: how to concatenate two lists

2010-09-20 Thread Parag Kalra
#!/usr/bin/perl use strict; use warnings; my @ar = ("rahul","patil"); my @ar1 = ("nitin"); my @ar4; push @ar4, (@ar, @ar1); print "@ar4"; Cheers, Parag On Mon, Sep 20, 2010 at 12:49 AM, rahul patil wrote: > Hello all, > > below is sample code i have written.Is it right way to declare ar4 whi

how to concatenate two lists

2010-09-20 Thread rahul patil
Hello all, below is sample code i have written.Is it right way to declare ar4 which is concatenation of ar and ar1 #!/usr/bin/perl @ar = {"rahul","patil"}; @ar1 = {"nitin"}; @ar4 = {...@ar,@ar1}; print @ar4[2]; if yes, why it is not printing output as nitin on my system -- Regards, Rahul Patil

RE: What does -w means in #!/usr/bin/perl -w

2010-09-20 Thread Kammen van, Marco, Springer SBM NL
>-Original Message- >From: rahul patil [mailto:rahul.deshmukhpa...@gmail.com] >Sent: Monday, September 20, 2010 8:59 AM >To: beginners@perl.org >Subject: What does -w means in #!/usr/bin/perl -w >Hello all, >I use linux. >whenever we write a perl script we use >#!/usr/bin/perl -w >at th