| spyroboy | wait, got an idea. Uh yeah.. |
| blue_sky | I have a file with 1.2 million lines over which I have to iterate. Which is faster, while or foreach? |
| mauke | while |
| Ani-_ | Depends on how you use it. |
| Botje | if you have to ask, you're probably not fit to be handling 1.2M line files ;) |
| CaT[tm] | ooooooo |
| Botje | hello for qw(mauke Ani-_ f00li5h CaT[tm]) |
| Ani-_ | You should read the file line by line using while. You should not read the entire file in an array and then use a while to loop over it. |
| fbred | or maybe 1000 lines a time? |
| Ani-_ | line per line. Let Perl handle the buffering |
| action | CPAN upload: Mediawiki-POD-0.03 by TELS |
| CPAN | upload: Mediawiki-POD-0.03 by TELS |
| Teratogen | doesn't thee operating system handle file buffering? |
| matteo | cpan> i /Video::Info/ Module Video::Info (N/A) |
| Teratogen | demand paging |
| matteo | i guess it is unavailable |
| Khisanth | your metadata file is wrong |
| blue_sky | mauke, thanks... hey, and Botje, I may not have the experience, but some bugger's gotta do this :) |
| Botje | agreed :p |
| blue_sky | Ani-_, I shall not, as you suggest, read it into an array first! (I'm *not* that dumb... contrary to popular belief) |
| Khisanth | then why did you ask about foreach? ;) |
| Ani-_ | (blue_sky: what Khisanth asked) I was typing the same thing... foreach (<FH>) { } will first read the entire FH into memory |
| f00li5h | trusty old list context |
| blue_sky | just in case I was missing something, 1.2 mil. lines is more than I've handled before and I dont' want to cripple the system while its doing this |
| spyroboy | lol blue_sky, add a fractional script pause at the end of every line. don't ask me how, should be something like sleep(.025); |
| Ani-_ | eval: sub s1 { print ((wantarray ? "" : "no ") . "wantarray"; 0 } for (; s1 ; ) { } |
| buubot | Ani-_: Error: syntax error at eval line 1, at EOF |
| Ani-_ | eval: sub s1 { print ((wantarray ? "" : "no ") . "wantarray"; 0; } for (; s1 ; ) { print "a" } |
| blue_sky | thanks for the suggestions all,.... spyroboy I'll think about it, thanks. |
| buubot | Ani-_: Error: syntax error at eval line 1, at EOF |
| mauke | eval: sub s1 { print ((wantarray() ? "" : "no ") . "wantarray"; 0 } for (; s1 ; ) { } |
| Khisanth | Ani-_: missing ) |
| buubot | mauke: Error: syntax error at eval line 1, at EOF |