Re: Uninitialized Value, but It Isn't, so Why?

2017-03-02 Thread Chas. Owens
On Thu, Mar 2, 2017, 19:32 Shawn H Corey wrote: > On Thu, 2 Mar 2017 16:35:17 -0600 > Andy Bach wrote: > > Hah! "undef" is an uninitialized value ! > > $ perl -we 'if (not $interdest5) {$interdest5 = "";} print > "|$interdest5|\n"' > || > $ perl -we 'if

Re: Parsing web pages

2017-03-02 Thread X Dungeness
Take a look a WWW::Mechanize. The older web suite LWP is an alternative and that may be enough if you only need a specific item. LWP::Simple is a possibility to see if you can mine the info from the page. If there's more complexity, then LWP::UserAgent is a starting point. A couple of books too:

Re: Uninitialized Value, but It Isn't, so Why?

2017-03-02 Thread Shawn H Corey
On Thu, 2 Mar 2017 16:35:17 -0600 Andy Bach wrote: > if ( not defined $interdest5 ) ... > > defined() is the built in function. "undef" is a value ... not sure > why you don't get a syntax error there but, most likely, the if quits > at seeing "undef" as it's "false" > >

Fwd: Parsing web pages

2017-03-02 Thread kavita kulkarni
Hello, Can you suggest some effective ways to parse multiple web pages from the web site. I cannot use web crawling as the format of the pages is not same. I am interested in the data from specific table on each page. Thanks in advance. Kavita

Re: Uninitialized Value, but It Isn't, so Why?

2017-03-02 Thread Andy Bach
On Thu, Mar 2, 2017 at 1:57 PM, Danny Spell wrote: > > So I'm like, a-ha!, I know I'll add this before the return in the routine. > if (undef $interdest5) {$interdest5 = "";} > if ( not defined $interdest5 ) ... defined() is the built in function. "undef" is a value

Re: Uninitialized Value, but It Isn't, so Why?

2017-03-02 Thread Shawn H Corey
On Thu, 2 Mar 2017 12:29:42 -0600 Danny Spell wrote: > Line 57 is "last if ($interdest5 ne "");". > > Why does Perl say it is uninitialized ? > I thought I took care of that in two places. Once when it was > declared and and again within the loop. Because you assign it a

Uninitialized Value, but It Isn't, so Why?

2017-03-02 Thread Danny Spell
sub mexicoRouteCheck{ my $interdest5 = ""; ($cc) = @_; $sth_mex = $dbh->prepare("select interdest5 from mexicoRoutingCodes where digits = ? "); for($l=6; $l>3; $l--){ $interdest5 = ""; $sth_mex->execute( substr($cc,0, $l)

Re: Converting string to float

2017-03-02 Thread Gil Magno
On Thu, Mar 02, 2017 at 04:50:32PM +, mailing lists via beginners wrote: > > > just to clarify, the real purpose of the script is output the hash to a json > object, so the json output for the script: So you have to "numify" your number: https://metacpan.org/pod/JSON::PP#PERL-%3E-JSON

Re: Converting string to float

2017-03-02 Thread Илья Рассадин
See docs https://metacpan.org/pod/JSON::PP#simple-scalars You do print Dumper on hash, it stringifies all hash values, so you see such an obscure result for encode_json. If don't dump $hash before encode json you get what you want - work_hours_to_float_try2 is json valid number

Re: Converting string to float

2017-03-02 Thread Shawn H Corey
On Thu, 2 Mar 2017 16:50:32 + (UTC) mailing lists via beginners wrote: > $VAR1 = { > 'work_hours_to_float_try3' => '5.2', > 'work_hours_to_float_try2' => '4.1', > 'work_hours' => '4.1', > 'work_hours_to_float_try1' => '4.10' > }; >

Re: Converting string to float

2017-03-02 Thread mailing lists via beginners
just to clarify, the real purpose of the script is output the hash to a json object, so the json output for the script: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use JSON::PP; my ($input_string, %job_task); sub sanitize_data{ my $data = shift; $data->{'work_hours'} =

The Perl Conference 2017 in DC (aka YAPC::NA 2017) - Call for Speakers

2017-03-02 Thread Brock Wilcox
This year we are holding the largest North-America Perl Conference in Washington, DC, at the US Patent and Trademark Office. It's a high-quality, inexpensive technical conference with its roots in the Perl Mongers user groups. The conference celebrates the Perl programming language and community,

Converting string to float

2017-03-02 Thread mailing lists via beginners
Helo all, what I am trying to do is convert a value contained whitin a hash from string to float, but I fail to find the error, this is that I have tried: $ cat test.pl #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my ($input_string, %job_task); sub sanitize_data{ my $data =