Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: 2 dimensional array

by starbolin (Hermit)
on Jun 23, 2008 at 05:50 UTC ( [id://693445]=note: print w/replies, xml ) Need Help??


in reply to 2 dimensional array

Very hard to offer meaningful help without the code that is failing but I'll try anyway. You need to check the data that you read in before assigning it to the array. The read could return a null record. Especially the last read in the file can return an undef. This is generally not a problem when you use the  while(<FH>) construct because that is shorthand for  while(defined($_=<FH>)) but if you use other read methods you have to call defined() yourself.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Replies are listed 'Best First'.
Re^2: 2 dimensional array
by ysth (Canon) on Jun 23, 2008 at 07:51 UTC
    He's doing a list-context read, which will read all the records in the file and then stop. There is no concern that there be an undef included in the returned lines.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://693445]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-19 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found