Dec 2, 2010, 6:32 AM
Post #7 of 14
I don't usually use 'strict', but tried it. That totally blew out everything (errors all over the place), so I put "my" in front of a whole bunch of varables and arrays until the errors stopped and there are no results at all now.
Much better. Though there are cases where it makes sense to release strictness, these should be exceptions, and confined to a small block.
Maybe you can re-post the current version of your program, i.e. the version you made strict?
Not sure what you mean. Do you mean the months file.
Your program basically goes like this:
open (MNF,"$mfl") || die("Cannot open $mfl");
@mfl = <MNF>;
.... # do something with @mfl
So you first put the whole file into an array (@mfl), and then you process the array. I was just curious why you do this, instead of processing the file line by line.
Turns out that is not needed as it is defined in the push.
This is *never* needed, as such a statement has no effect whatsoever. You just take the value of a variable, and then throw it away. It's a no-op.
Don't know, but it works as it's referring to array mfl from when the file was opened. No errors came up.
I'm not sure what you mean by "it works" (what is it doing?), but at least I learned that this construct is not illegal, as I thought before. However, I tried it out and found it pretty useless: In my experiments, <@mfl> evaluates to @mfl when executed in list context, and to $mfl in scalar context. Since you use it in scalar context, the statement is equivalent to
$mon = $mfl
which means that you always push the first element to your list in each operation.
If you want @lines contain the first $mts elements of @mfl, you could use array slices.