Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

next char ; syntax error in format

by neilwatson (Priest)
on Oct 17, 2009 at 00:43 UTC ( #801688=perlquestion: print w/replies, xml ) Need Help??
neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

I'm getting this error 'syntax error at ./ line 238, next char ;' Here is the code snippet. My perl is a bit rusty but this error is unfamiliar.
... 228 write $out; 229 } 230 close $out; 231 232 ########################## 233 # Formats 234 format PROJECT_TOP = 235 Project report for @* on (today) 236 --------------------------- 237 $PROJECT 238 . 239 240 format PROJECT = 241 @* @* @* @* @* 242 $DUE, $AT, $PRIORITY, $MSG, $CONTEXT 243 . 244 ...

Neil Watson

Replies are listed 'Best First'.
Re: next char ; syntax error in format
by biohisham (Priest) on Oct 17, 2009 at 13:44 UTC
    The error is that @* from the format for page header looks in the subsequent line for the scalar it can represent and finds nothing but a dashed line so a little permutation can solve that. Move $PROJECT over the dashed line.
    format PROJECT_TOP = Project report for @* on (today) $PROJECT --------------------------- .
    Why bichonfrise74 solution would not work, consider having added that line and see the output:
    format STDOUT_TOP = Project report for Mr. @* on (today) --------------------------- $PROJECT_HEAD . format STDOUT = @* @* @* @* @* $DUE, $AT, $PRIORITY, $MSG, $CONTEXT . my $PROJECT_HEAD="NeilWatson"; write;
    #OUTPUT Project report for Mr. on (today) --------------------------- $PROJECT_HEAD
    As you could see @* read the empty line and hence showed empty value for the title and this served to silence perl from complaining. Now consider the output from the following code snippet:
    format STDOUT_TOP = Project report for Mr.@* on (today) $PROJECT_HEAD --------------------------------- . format STDOUT = @* @* @* @* @* $DUE, $AT, $PRIORITY, $MSG, $CONTEXT . $PROJECT_HEAD="NeilWatson"; write;
    #OUTPUT: Project report for Mr.NeilWatson on (today) ---------------------------------
    It'll be better if you removed the line numbers from the code segment in future posts, that makes it easier to get down to work with eliminating the need for having to manually remove the line numbers.

    Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.
Re: next char ; syntax error in format
by bichonfrise74 (Vicar) on Oct 17, 2009 at 03:17 UTC
    I'm not familiar with 'format', but it looks like if you add an empty line after line 235, then it would work. Try to check perlform. Please see below.
    #!/usr/bin/perl use warnings; use strict; my ($DUE, $AT, $PRIORITY, $MSG, $CONTEXT); format PROJECT_TOP = Project report for @* on (Today) --------------------------- $PROJECT . format PROJECT = @* @* @* @* @* $DUE, $AT, $PRIORITY, $MSG, $CONTEXT .
Re: next char ; syntax error in format
by Marshall (Abbot) on Oct 17, 2009 at 13:22 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://801688]
Approved by ww
Front-paged by planetscape
[marioroy]: The MCE::Hobo::Pool module will come later.
[Corion]: marioroy: Oh, that's always cool, having API-compatible modules. This makes testing and comparing things much easier
[marioroy]: IPC in MCE::Shared can handle 400k (sends) per second. That's seems a lot for being a pure-Perl module. After making the release, will come back and post a solution for a node by a fellow wanting faster logging.
[Corion]: While working on WWW::Mechanize:: Chrome, I had the suspicion that AnyEvent was doing something wrong, but I was able to swap it out for Mojolicious and the error persisted.
[Corion]: Of course, the error was in my own code ;)

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2017-05-26 08:36 GMT
Find Nodes?
    Voting Booth?