You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Gerald Richter <ri...@ecos.de> on 2001/08/14 15:46:31 UTC

Re: question RE: using file handler to read a flatfile and spit out split values


> Hi all, apologize if this is a simple question. Couldn't find leads on the
> problem in the archives.
>
> A simple script to read a flatfile works when I run it from the shell as a
> .pl file (formmated differently of course). Doesn't put anything out onto
> browser running  as an .epl file, however. Any ideas? Have a feeling it's
> something to do with doing printf?
>

Yes, you either have to print to the handle OUT or set the option
optRedirectStdout in your httpd.conf

> foreach $data(@data){
> ($firstname,$lastname,$msg)=split(/\s*\|\s*/,$data);

printf OUT "First Name: $firstname";
printf OUT "Last Name: $lastname";
printf  OUT "Message : $msg";
> }
>

BTW You should either use print instead of printf or write

printf OUT "First Name: %s", $firstname ;

otherwise you may create a security whole, if there are some of the printf
special chars inside of your file (in Perl that isn't as bad as in C, but I
would avoid it nevertheless)

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org