develooper Front page | perl.beginners | Postings from February 2002

Minor issues with format()

Thread Previous
From:
gkhgkh
Date:
February 26, 2002 10:24
Subject:
Minor issues with format()
Message ID:
20020226182357.EVBF2951.rwcrmhc53.attbi.com@rwcrwbc57
I see what is happening, I think:  I am writing to a 
separate file each time through the loop and format 
doesn't know that each time through is a different page, 
I think.  Any pointers on how to tell format to print 
the header at the start of each new file would be 
greatly appreciated.

Thanks for your help.

 
> The only problem I have with the following script is it 
> does not print the header information on the first 
> page.  I must have missed something.  
> 
> I would appreciate any comments/suggestions.
> 
> Thanks
> 
> #!/usr/bin/perl -w
> 
> use strict;
> 
> use constant PATH 
> => "/usr/local/scripts/security/sybase/user/";
> use constant GROUPS => "group_files.doc";
> use constant ACCESS => "user_access_all.doc";
> 
> my $user;
> 
> open F_GROUPS, PATH.GROUPS    or die "Can't open:  $!";
> 
> while (<F_GROUPS>) {
>     chomp(my @field = split /:/);
>     
>     open OUT, ">$field[1]"  or die "Can't open:  $!";
>     open F_ACCESS, PATH.ACCESS    or die "Can't open:  
> $!";
>     
>     while (<F_ACCESS>) {
>         chomp ();        
>         $user = $_;        
>         write OUT if (/$field[0]/);
>     }
>     
> format OUT_TOP =
> 
> ||||||||||||||||||||Company Name||||||||||||||||||||||
> ||||||||||||||||||||Report Title|||||||||||||||||||||||||
> 
> Security Group              First Name                
> Last Name
> ..
> 
> format OUT = 
> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> $user,
> ..
> 
>     
>         
>     close OUT                   or die "Can't close:  
> $!";
>     close F_ACCESS              or die "Can't close:  
> $!";
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> 

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About