Phoenix.pm: Code problem

Warner, David David.Warner at feddata.com
Tue Oct 12 18:53:44 CDT 1999


Sure...since I went through it bit by bit a little while ago in an attempt
to figure out what was wrong, I'll step up to the bat...

	$size  will contain the result of whatever is returned by the
system-level commands between the backticks (``).

	wc -w $outfile  - a unix command to count the words in $outfile.
	...which is then piped to....
	tr -s " "  	    - a unix command to replace 1+ spaces with 1
space.
	...which is then piped to....
	cut -f1 -d " "  - a unix command to return the first field (f1),
fields being delimited by a space " "


	I agree that the buffer is probably not getting flushed and that is
why $size contains just zero, although it does bother me that I can't find
one example using pipes in a backticked call.  Has anyone ever used pipes in
this context successfully?



	Hope this helps.


				Dave Warner




-----Original Message-----
From: Beaves at aol.com [mailto:Beaves at aol.com]
Sent: Tuesday, October 12, 1999 4:33 PM
To: phoenix-pm-list at happyfunball.pm.org
Subject: Re: Phoenix.pm: Code problem


OK, OK!!  I have to fess up that the $size assignment in Ron's code is 
totally and completely greek to me...

$size = `wc -w $out_file | tr -s " " | cut -f1 -d " "` ;

Can someone go through that assignment statement,  character by character
and 
decipher it for me (and I'm sure others)?

Thanks.

Feeling stupider than the original code writer by suggesting it was a 
returned list...,

Tim


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/phoenix-pm/attachments/19991012/391faf6d/attachment.htm


More information about the Phoenix-pm mailing list