Thanks, Luis. I was aware of [$ foreach $] but wasn't sure if it could be
used when opening a file handler. Thanks again. 
-Mike

Michael Angeles | Information Specialist
Lucent Tech./Bell Labs | Integrated Info. Solutions
e: [EMAIL PROTECTED] | t: 908 582 5589 | m: 917 613 6935 

> -----Original Message-----
> From: Luiz Fernando B. Ribeiro [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 8:35 AM
> To: Angeles, Michael (Michael)
> Subject: Re: question RE: using file handler to read a 
> flatfile and spit
> out s plit values
> 
> 
> Hi Michael,
> 
> Reply:
> 
> AMM> A simple script to read a flatfile works when I run it 
> from the shell as a
> AMM> .pl file (formmated differently of course). Doesn't put 
> anything out onto
> AMM> browser running  as an .epl file, however. Any ideas? 
> Have a feeling it's
> AMM> something to do with doing printf? 
> 
> AMM> [-
> AMM> $database = "/u4/angeles/public_html/test2.dat";
> 
> AMM> open(DB,$database) || die "error opening database";
> 
> AMM> while(<DB>){
> AMM>         @data = (<DB>);
> AMM> }
> 
> -] # close the -] here
> 
> Here you can use the Embperl [$ foreach $] construction:
> 
> AMM> foreach $data(@data){
> AMM>         ($firstname,$lastname,$msg)=split(/\s*\|\s*/,$data);
> AMM>         printf "First Name: $firstname";
> AMM>         printf "Last Name: $lastname";
> AMM>         printf "Message : $msg";
> AMM> }
> 
> [$ foreach $data @data $]
>    [- ($firstname,$lastname,$msg)=split(/\s*\|\s*/,$data); -]
>    First Name: [+$firstname+]
>    Last Name: [+$lastname+]
>    ...
> [$ endforeach $]
> 
> [- close DB -]
> 
> 
> Bye,
> 
> Luiz Fernando B. Ribeiro
> ----------------------------
> At Home - Design e Internet
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to