Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: list assignment to list in scalar context (boolean)

by tye (Sage)
on Nov 09, 2012 at 03:45 UTC ( #1003054=note: print w/replies, xml ) Need Help??


in reply to list assignment to list in scalar context

List assignment in a scalar context returns the number of items in the right-hand side because that is extremely useful as a Boolean test, as shown in your own example:

while( my( $k, $v ) = each %h ) {

You wouldn't want that loop to terminate early just because one of the values in %h was false.

- tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003054]
help
Chatterbox?
[afoken]: Also: All other attributes that start with csv_ and are not described above will be passed to Text::CSV_XS (without the csv_ prefix).
[Discipulus]: what about a good 'ol SOPW?
[erix]: Giro d'Italia won by Dumoulin (peccato Nibali)
[ELISHEVA]: csv_detect_bom doesn't work either
[erix]: (SCNR)
[ELISHEVA]: I may have to resort to SOPW - but was hoping that this would be something simple
[erix]: I'd just remove the BOM, it is pretty simple
[ELISHEVA]: Simple yes. and I did consider that. but this isn't one off . An important data source that I don't control is generating bom prefixed utf8 files and I'd rather not have to be munging files every few months.
[erix]: on teh other hand a SOPW is pretty much garanteed to get an answer from tux (and probably the module fixed)
[ELISHEVA]: plus it bugs me that something that *should* be simple, *should* work- unicode and noms aren't exactly the new kids on the block

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-05-28 20:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?