Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: extracting data

by moritz (Cardinal)
on Jun 27, 2012 at 06:35 UTC ( #978569=note: print w/replies, xml ) Need Help??


in reply to extracting data

Always use strict; use warnings; it would tell you what's wrong.

There are two problems with your code. The first is that compare strings with ==, even though that operator does numeric comparison. And the second is that if there are only two chunks in the original string, $split_data[2] will not be the empty string, but undef.

So your test should look more like

if (!defined($split_data[2]) || $split_data[2] eq '0') { print $split_data[1], "\n"; }

Replies are listed 'Best First'.
Re^2: extracting data
by prassi (Acolyte) on Jun 27, 2012 at 07:01 UTC

    Thanks moritz.... yeah I dint realized the string comparison.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://978569]
help
Chatterbox?
[Cosmic37]: well... maybe not that much...
[corenth]: I want to climb in and look at how these neural networks work.
[erix]: I'd first make sure /that/ they work ;)
[Cosmic37]: basically there is a layer of inputs (an array of input numbers); each input can be "fully interconnected" with the next layer of "neurons" - each neuron of the next layer typically multiplies all of the outputs from the previous layer by weights ...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-02-20 18:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (274 votes). Check out past polls.

    Notices?