John W. Krahn wrote:
> Mathew Snyder wrote:
>> Thanks for enlightening me about 'format'
>>
>> I've run your example code from the command line and got exactly the results
>> you
>> did (not that I'd expect to get anything different ;) ). I then attempted to
>> incorporate the idea into my script:
>>
>> foreach my $user (keys %tikNums) {
>> open TIMESHEET,
>> ">/work_reports/ticketlists_$endDate/ticketlist_$user.txt";
>> print TIMESHEET "List of tickets worked on by $user during week
>> ending
>> $endDate", "\n\n";
>> foreach my $env (sort keys %{ $tikNums{$user} }){
>> #Print the header for our data
>> print TIMESHEET $env . "\n";
>> printf TIMESHEET "%10s%10s\n", "Ticket ID","hh:mm";
>> print TIMESHEET ("-" x 20);
>> print TIMESHEET "\n";
>> foreach my $id (sort keys %{ $tikNums{$user}{$env} }) {
>> format STDOUT_TOP =
>> @<<<<<<<<<<<<<<<<<<<<
>> $env
>> Ticket ID Subject
>> hh:mm
>>
>> -------------------------------------------------------------------------
>> .
>> format STDOUT =
>> @######
>> ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>:>>
>> $id, $tikSubj{$id},
>> $tikNums{$user}{$env}{$id}
>> ~~
>> ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>> $tikSubj{$id}
>> }
>> write TIMESHEET;
>> print TIMESHEET "\n";
>> }
>> close TIMESHEET;
>> }
>>
>> However, when I run the script I get the following error:
>> Format not terminated at ./ticket_lists.pl line 128, at end of line
>> syntax error at ./ticket_lists.pl line 128, at EOF
>> Execution of ./ticket_lists.pl aborted due to compilation errors.
>>
>> Line 128 only contains my 'exit;' statement. I've got the periods where they
>> belong but can't figure out why it would tell me the format hasn't been
>> terminated.
>>
>> Any insight will be appreciated.
>
> perldoc perlform
>
> [ snip ]
>
> Output record formats are declared as follows:
>
> format NAME =
> FORMLIST
> .
>
> If the name is omitted, format "STDOUT" is defined. A single "." in column
> ^^^^^^^^^^^^^^^^^^^^^^
> 1 is used to terminate a format.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>
>
>
> John
Ahhh...I took column 1 to mean the first column under format (The way I lined
them up) instead of the actual first column of the entire line.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/