Phoenix.pm: Perl stuuf

Shay Harding sharding at ccbill.com
Tue Mar 2 14:28:58 CST 1999


On Tue, 02 Mar 1999, you wrote:
>Hey, look! An actual Perl-related email!
>
>So, I have this little update pl fed by an HTML form. One of the things it
>does is to store a copy of the updated content seperate so that it can be
>edited later. So, here is where it gets wierd...
>
>$text = $FORM{'text'};
>$action = $FORM{'action'};
>$action = "nada" unless $action;
     ### $action = "nada" if !$action; ### :)
>
>if ($action =~ "norm") {
> 	unless (open (TEXT, ">$path/idx.txt")) {
> 		$msg = "(1) Could not open $path/idx.txt";
> 		&mailme;
> 		exit;
> 	}
> 	print TEXT "$text";
> 	close <TEXT>;
>
>(just a fragment of the code...)
>
>So on our machine there is no problem, but on the clients maching, the
>data file "idx.txt" ends up containing the contents of $text, followed by
>the words ("nada" unless $action;)
>
>Any ideas what the hell is causing this???

Ahhh.. 'unless' must diiiee...:) Phew got that out. Sorry I just hate unless.
Why not use if !condition? Saves 4 bytes :)


--

Shay Harding
sharding at ccbill.com



More information about the Phoenix-pm mailing list