Re: series of numbers to range notation

2014-01-07 Thread Dr.Ruud
On 2014-01-07 20:28, Rajeev Prasad wrote: so i have this series of numbers: 349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,425,426,427,428,429,430,431

Re: series of numbers to range notation

2014-01-07 Thread Uri Guttman
On 01/07/2014 02:56 PM, David Precious wrote: On Tue, 7 Jan 2014 13:35:39 -0600 Hal Wigoda wrote: On Tue, Jan 7, 2014 at 1:28 PM, Rajeev Prasad <.ne...@yahoo.com> wrote: so i have this series of numbers: [...] there are two ranges in there: 349-396, 425-496 any hints as to how to write a perl

Re: series of numbers to range notation

2014-01-07 Thread David Precious
On Tue, 7 Jan 2014 13:35:39 -0600 Hal Wigoda wrote: > On Tue, Jan 7, 2014 at 1:28 PM, Rajeev Prasad <.ne...@yahoo.com> > wrote: > > so i have this series of numbers: > > [...] > > there are two ranges in there: 349-396, 425-496 > > > > any hints as to how to write a perl code to represent the ser

Re: series of numbers to range notation

2014-01-07 Thread Hal Wigoda
(349..396,425..496); On Tue, Jan 7, 2014 at 1:28 PM, Rajeev Prasad wrote: > so i have this series of numbers: > > 349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394

series of numbers to range notation

2014-01-07 Thread Rajeev Prasad
so i have this series of numbers: 349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,

Re: Arrow Notation vs. Colon Notation

2011-07-21 Thread C.DeRykus
On Jul 20, 6:09 pm, shawnhco...@gmail.com (Shawn H Corey) wrote: > On 11-07-20 07:03 PM, Uri Guttman wrote: > > > the other is a class method call. it has two major differences. first it > > will pass its class (or object, the arg before ->) as the first arg in > > the call. the second thing is tha

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Rob Dixon
On 21/07/2011 05:32, Rob Dixon wrote: It would be possible to generate calls to undefined subroutines at compile time, but because the symbol table can be modified at run time with such trickery suck as *Foo::bar = \&Foo::foo it is also left until run time to report any such errors. My apolog

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> I'm not sure what you mean here Shawn. Errors are generated at run time RD> in both cases, so code like RD> if (0) { RD> Foo::bar(); RD> } RD> if (0) { Foo-> bar(); RD> } RD> will generate no errors at all. In particular the meth

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Rob Dixon
On 21/07/2011 02:09, Shawn H Corey wrote: On 11-07-20 07:03 PM, Uri Guttman wrote: the other is a class method call. it has two major differences. first it will pass its class (or object, the arg before ->) as the first arg in the call. the second thing is that it will search the class hierarchy

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Shawn H Corey
On 11-07-20 07:03 PM, Uri Guttman wrote: the other is a class method call. it has two major differences. first it will pass its class (or object, the arg before ->) as the first arg in the call. the second thing is that it will search the class hierarchy (using the package global's @ISA) to find

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread jbiskofski
Marc that was a really good question. On the surface they do seem exactly alike. Cheers! - biskofski On Jul 20, 2011, at 6:29 PM, Marc wrote: > On Jul 20, 2011, at 4:03 PM, Uri Guttman wrote: > >> so don't think they are even similar as one is a sub call and the other >> is a class method c

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Marc
On Jul 20, 2011, at 4:03 PM, Uri Guttman wrote: > so don't think they are even similar as one is a sub call and the other > is a class method call. they aren't interchangeble at all Yep, you're correct. Why is everything so simple once someone explains it to you??? =;) That al

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Uri Guttman
> "M" == Marc writes: M>I've noticed that the following two lines seem to be equivalent when calling a sub from a module called Lib.pm: Lib-> load_config("config.dat"); M> Lib::load_config("config.dat"); M>Is this just a case of TIMTOWTDI or is there a difference in how

Arrow Notation vs. Colon Notation

2011-07-20 Thread Marc
I've noticed that the following two lines seem to be equivalent when calling a sub from a module called Lib.pm: Lib->load_config("config.dat"); Lib::load_config("config.dat"); Is this just a case of TIMTOWTDI or is there a difference in how they do what they do? Marc -- To uns

Re: print flips to scientific notation when integer exceeds 15 decimal digits

2009-11-05 Thread David Lee
Philip Potter wrote: 2009/11/4 David Lee : [...] Anyway, your explanation was useful and gives us sufficient to decide how to address our local use of these numbers. (In our case, they are human-oriented accumulated byte-counts, for which we don't actually need that significance/precision.)

Re: print flips to scientific notation when integer exceeds 15 decimal digits

2009-11-04 Thread David Lee
Philip Potter wrote: I would guess that these numbers are being stored in floats, and that these floats are 64-bit double precision, with 53 bits of mantissa. That means that there are just under 16 decimal digits of precision in these numbers. print and friends seem to automatically print no mo

Re: print flips to scientific notation when integer exceeds 15 decimal digits

2009-11-04 Thread Philip Potter
2009/11/4 David Lee : > Many thanks for the reply. > > Following the initial surprise, my main concern was that attempts to unearth > a description or explanation (i.e. documentation) for the observed behaviour > was so tricky.  For instance, there was nothing obvious in the relevant > parts of "Pr

Re: print flips to scientific notation when integer exceeds 15 decimal digits

2009-11-03 Thread Philip Potter
eger; indeed it usually does so.  But when its size takes it from 15 > decimal digits to 16 decimal digits, that "print" flips the output into > scientific notation: >   997 >   998 >   999 >   1e+15 >   1e+15 > > Ouch.  The surp

print flips to scientific notation when integer exceeds 15 decimal digits

2009-11-03 Thread David Lee
hen its size takes it from 15 decimal digits to 16 decimal digits, that "print" flips the output into scientific notation: 997 998 999 1e+15 1e+15 Ouch. The surprise is especially nasty when this output data is then used as input

Re: !! notation

2009-09-09 Thread Chas. Owens
On Wed, Sep 9, 2009 at 09:46, Dermot wrote: snip > my $var = !! $class->method; snip This is really my $var = ! ( ! $class->method ); People do this to create a boolean like value. Perl has many false values and many true values: False: (), "", "0", 0, 0.0, and undef True: any value that expl

Re: !! notation

2009-09-09 Thread Shawn H Corey
Dermot wrote: Hi, I saw this notation today: !! $class->method; or as an assignment: my $var = !! $class->method; I can't find a definition for it in perlsyn or perlop. I don't think it's restricted to classes. I suspect this is boolean but I'd like to know. Any

!! notation

2009-09-09 Thread Dermot
Hi, I saw this notation today: !! $class->method; or as an assignment: my $var = !! $class->method; I can't find a definition for it in perlsyn or perlop. I don't think it's restricted to classes. I suspect this is boolean but I'd like to know. Any pointers? Thanx,

Re: Convert Scientific Notation to decimal equivalent

2007-07-20 Thread Dr.Ruud
Xavier Noria schreef: > Detecting whether something holds in an array is the job of grep: > >my $numbers = grep /\A$RE{num}{real}\z/, @data; >next unless $numbers == @data; Alternative: die if grep !/\A$RE{num}{real}\z/, @data; my $numbers = scalar @data; -- Affijn, Ruud "Gewo

Re: Convert Scientific Notation to decimal equivalent

2007-07-19 Thread Xavier Noria
El Jul 19, 2007, a las 12:19 AM, Joseph L. Casale escribió: Interesting, I see from your regexp you use a \A and \z, from Perldoc this means: \A Match only at beginning of string \z Match only at end of string I am not sure I understand this requirement? ^ and $ depend on flags, and

Re: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Chas Owens
On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote: Chas, Sorry but I am not clear on what you mean by reduce? Do you mean remove all non numbers from the array? snip Sort of, the code doesn't modify the original array, it creates a new array with only the values that are numbers. -- To un

RE: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Joseph L. Casale
Subject: Re: Convert Scientific Notation to decimal equivalent On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote: > Interesting, > I see from your regexp you use a \A and \z, from Perldoc this means: > \A Match only at beginning of string > \z Match only at end of st

Re: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Chas Owens
On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote: Interesting, I see from your regexp you use a \A and \z, from Perldoc this means: \A Match only at beginning of string \z Match only at end of string Is "foo10bar" valid? /^$RE{num}{real}$/ says no, but /$RE{num}{real}/ says yes

Re: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Chas Owens
5313 28.90625 0 > > And my code is skipping some lines as it checks for any erroneous data: > next if grep (/[^0-9.-]/, @data); > But that thinks the scientific notation is bad. I searched the net and > didn't find anything. How can I match this specific pattern and convert it?

RE: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Joseph L. Casale
Notation to decimal equivalent El Jul 18, 2007, a las 11:19 PM, Joseph L. Casale escribió: > How can I detect this, I have been running some code for a few days > to develop some files and ran into the situation where I am getting > the following data for input: > > 14.9

Re: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Xavier Noria
that thinks the scientific notation is bad. I searched the net and didn't find anything. How can I match this specific pattern and convert it? I am not sure I understand the problem to solve. You need to filter out lines that contain something that's *not* a number? If that'

Re: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread John W. Krahn
-14.45313 0 -14.95313 1.570813E-015 0 -14.95313 14.45312 0 14.95313 -28.90625 0 0 -28.90625 0 -14.95313 28.90625 0 0 28.90625 0 14.95313 28.90625 0 And my code is skipping some lines as it checks for any erroneous data: next if grep (/[^0-9.-]/, @data); But that thinks the scientific notation is bad. I

Re: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Chas Owens
ks the scientific notation is bad. I searched the net and didn't find anything. How can I match this specific pattern and convert it? Thanks! jlc Don't write the regex yourself, use one of the ones in Regexp::Common*. $RE{num}{real} is probably what you want. As for how to make "

Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Joseph L. Casale
-015 0 -14.95313 14.45312 0 14.95313 -28.90625 0 0 -28.90625 0 -14.95313 28.90625 0 0 28.90625 0 14.95313 28.90625 0 And my code is skipping some lines as it checks for any erroneous data: next if grep (/[^0-9.-]/, @data); But that thinks the scientific notation is bad. I searched the net and

Re: Using the () list notation with $scalars

2004-07-01 Thread Rob Benton
John W. Krahn wrote: On Thursday 01 July 2004 14:30, Rob Benton wrote: I'm looking for a little help here. I'm not understanding exactly what's wrong with this code: === #!/usr/bin/perl -w use strict; open IN, " my %rows; while () { c

Re: Using the () list notation with $scalars

2004-07-01 Thread John W . Krahn
On Thursday 01 July 2004 14:30, Rob Benton wrote: > > I'm looking for a little help here. I'm not understanding exactly > what's wrong with this code: > > === > #!/usr/bin/perl -w > > use strict; > > open IN, " > my %rows; > > while () >

Re: Using the () list notation with $scalars

2004-07-01 Thread Gunnar Hjalmarsson
Rob Benton wrote: $rows{$fields[2]} = [ ($fields[3]..$fields[-1]) ]; Depending on what the fourth and last elements in @fields contain, that range can be very, very long... I think this is what you mean: $rows{$fields[2]} = [ @fields[3..$#fields] ]; -- Gunnar Hjalmarsson Email: http://www

RE: Using the () list notation with $scalars

2004-07-01 Thread Charles K. Clarkson
Rob Benton <[EMAIL PROTECTED]> wrote: : I'm looking for a little help here. I'm not understanding exactly : what's wrong with this code: : : === : #!/usr/bin/perl -w : : use strict; : : open IN, ") : { : chomp; : my @field

Re: Using the () list notation with $scalars

2004-07-01 Thread Jeff 'japhy' Pinyan
On Jul 1, Rob Benton said: > $rows{$fields[2]} = [ ($fields[3]..$fields[-1]) ]; You're doing two things wrong: the '..' operator needs to be INSIDE the subscript. @fields[$lower .. $upper] The other thing is that you can't do a range like that. If you want to get the elements from [3] t

Using the () list notation with $scalars

2004-07-01 Thread Rob Benton
I'm looking for a little help here. I'm not understanding exactly what's wrong with this code: === #!/usr/bin/perl -w use strict; open IN, " my %rows; while () { chomp; my @fields = split( /,/, $_); $rows{$fields[2]} = [ ($f

Re: comparing scientific notation

2004-03-19 Thread Paul Johnson
Charles Lu said: > Hi Hello > If i want to compare 2 values in scientific notation i.e. > > 1.2e-400 4.3e-200 > > > I cannot use simply use "< , > " operator. For some reason, > 0 > 1e-400. That's a pretty small number. On most 32 bit sys

comparing scientific notation

2004-03-19 Thread Charles Lu
Hi If i want to compare 2 values in scientific notation i.e. 1.2e-400 4.3e-200 I cannot use simply use "< , > " operator. For some reason, 0 > 1e-400. Is there a module I can use? thanks Charles _ Get

RE: New Object Notation vs @{$hash{key}}

2003-12-12 Thread Paul Kraus
> I wouldn't necessarily call it a bad habit as it does execute > properly, it just doesn't produce as readable of code... Rob > already covered -> well so I will just point you to some > "light" reading if you thirst for more... > > perldoc perlreftut > perldoc perlref > perldoc perldsc > per

Re: New Object Notation vs @{$hash{key}}

2003-12-12 Thread Rob Dixon
Wiggins D Anconia wrote: > > > I think I am picking up some bad habits so maybe you guys can help. > > > > I currently use this notation @{$hash{key}} to access an array stored in > > a hash. > > I keep seeing posts that it is better to use an object like notatio

Re: New Object Notation vs @{$hash{key}}

2003-12-12 Thread Wiggins d Anconia
> I think I am picking up some bad habits so maybe you guys can help. > > I currently use this notation @{$hash{key}} to access an array stored in > a hash. > I keep seeing posts that it is better to use an object like notation. > Can I see some examples on how you would acce

Re: New Object Notation vs @{$hash{key}}

2003-12-12 Thread Rob Dixon
Paul Kraus wrote: > > I think I am picking up some bad habits so maybe you guys can help. > > I currently use this notation @{$hash{key}} to access an array stored in > a hash. > I keep seeing posts that it is better to use an object like notation. > Can I see some examples on

New Object Notation vs @{$hash{key}}

2003-12-12 Thread Paul Kraus
I think I am picking up some bad habits so maybe you guys can help. I currently use this notation @{$hash{key}} to access an array stored in a hash. I keep seeing posts that it is better to use an object like notation. Can I see some examples on how you would access the array or an element of an

Re: explanation for *subroutine notation?

2002-01-03 Thread Jeff 'japhy' Pinyan
On Jan 3, KAVANAGH, Michael said: >*random_subroutine_name = sub ( ) { 1 }; > >Is there a name for this kind of operation? Typeglob assignment? Basically, you're assigning a code reference to a typeglob, which makes &random_subroutine_name be that function. Compare that with: *x = [1,2,3];

explanation for *subroutine notation?

2002-01-03 Thread KAVANAGH, Michael
Hi there I've been re-working some code from another developer and I came across a line that has me stumped. I can't find an explanation in Programming Perl, but it's probably because I don't know what to look for. The line is: *random_subroutine_name = sub ( ) { 1 }; Is there a name for this k

[Follow-up]RE: Printing with arrow notation

2001-11-15 Thread RArul
In my response, shown below, if I replace $rhash=shift; # My approach with $rhash=@_;# Your Approach then nothing will be printed. The reason is that the results are interpreted in a scalar notation when you adopt the latter approach. Therefore, never attempt to do an

RE: Printing with arrow notation

2001-11-15 Thread Gibbs Tanton - tgibbs
[EMAIL PROTECTED] Sent: 11/15/2001 10:08 AM Subject: Printing with arrow notation I am passing a hash as a reference to a subroutine and want to print its values using arrow notation. Such as.. %hash ("value1", "value2", etc..); PrintHash(\%hash); sub PrintHash { $rha

Re: Printing with arrow notation

2001-11-15 Thread register
to a subroutine and want to print its > values using arrow notation. Such as.. > %hash ("value1", "value2", etc..); > PrintHash(\%hash); >sub PrintHash > { > $rhash = @_; > What woul

RE: Printing with arrow notation

2001-11-15 Thread RArul
vandine [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 11:08 AM To: [EMAIL PROTECTED] Subject: Printing with arrow notation I am passing a hash as a reference to a subroutine and want to print its values using arrow notation. Such as.. %hash ("value1", "value2", et

Printing with arrow notation

2001-11-15 Thread jonathan vandine
I am passing a hash as a reference to a subroutine and want to print its values using arrow notation. Such as.. %hash ("value1", "value2", etc..); PrintHash(\%hash); sub PrintHash { $rhash = @_; What would work here for print using arro

RE: Trying to use the => notation to print the values from this hash

2001-11-14 Thread Bob Showalter
> -Original Message- > From: AMORE,JUAN (HP-Roseville,ex1) [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 13, 2001 10:58 PM > To: Beginners@Perl. Org (E-mail) > Subject: Trying to use the => notation to print the values from this > hash > > > Hel

RE: Trying to use the => notation to print the values from this hash

2001-11-14 Thread mark crowe (JIC)
ber 2001 03:58 > To: Beginners@Perl. Org (E-mail) > Subject: Trying to use the => notation to print the values from this > hash > > > Hello Perl Gurus, > I'm trying to print anyone of these values using the => notation. > I believe I can use => but not so

Re: Trying to use the => notation to print the values from this hash

2001-11-13 Thread Chris Ball
On Wed, 2001-11-14 at 03:57, AMORE,JUAN (HP-Roseville,ex1) wrote: > %Unix= ("SHELL" => "/bin/csh", >"PAGER" => "more", >"DB" => "mysql"); > > print "Value: ,=> $unix{SHELL}\n"; The => in the last line is not necessary: print "Value: ", $unix{"SHELL"}\n"; will DWYM. As a side poin

Trying to use the => notation to print the values from this hash

2001-11-13 Thread AMORE,JUAN (HP-Roseville,ex1)
Hello Perl Gurus, I'm trying to print anyone of these values using the => notation. I believe I can use => but not so sure how to use it. Can someone give me an example,...I tried different ways but have exhausted all means. Any hints:) Many Thanks! %Unix= ("SHELL" =>

Re: Arrow Notation Question

2001-06-27 Thread Paul
--- "Gross, Stephan" <[EMAIL PROTECTED]> wrote: > I'm using Win32::GUI. I create a text field and call it $TextField. > The > user inputs some text, say "abc". > If I say > print "$TextField->Text"; > I get > Win32::GUI::Textfield=HASH(0x23762b0)->Text > If instead I say > $x =

Re: Arrow Notation Question

2001-06-27 Thread iain truskett
* Brett W. McCoy ([EMAIL PROTECTED]) [27 Jun 2001 21:22]: > On Wed, 27 Jun 2001, Gross, Stephan wrote: > > I'm using Win32::GUI. I create a text field and call it $TextField. The > > user inputs some text, say "abc". > > If I say > > print "$TextField->Text"; > > I get > > Win32::GUI::T

Re: Arrow Notation Question

2001-06-27 Thread Brett W. McCoy
On Wed, 27 Jun 2001, Gross, Stephan wrote: > I'm using Win32::GUI. I create a text field and call it $TextField. The > user inputs some text, say "abc". > If I say > print "$TextField->Text"; > I get > Win32::GUI::Textfield=HASH(0x23762b0)->Text > If instead I say > $x = $TextField-

Arrow Notation Question

2001-06-27 Thread Gross, Stephan
I'm using Win32::GUI. I create a text field and call it $TextField. The user inputs some text, say "abc". If I say print "$TextField->Text"; I get Win32::GUI::Textfield=HASH(0x23762b0)->Text If instead I say $x = $TextField->Text; print "$x"; I get abc Why the differenc