Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Scaler found where opeartor expected Error

by poj (Priest)
on May 29, 2012 at 21:24 UTC ( #973128=note: print w/ replies, xml ) Need Help??


in reply to Scaler found where opeartor expected Error

push @body,"<tr><td rowspan=\"${\scalar @$books}\">$Author2</td>\n"; # add \ \ > ^ ^ ^ # remove , ^
poj


Comment on Re: Scaler found where opeartor expected Error
Download Code
Re^2: Scaler found where opeartor expected Error
by AnomalousMonk (Abbot) on May 29, 2012 at 23:58 UTC

    This fixes the immediate problem and leaves behind, IMHO, a little nightmare for the poor shlub who has to maintain this code six months or a year from now; better make sure he or she does not know your name or where you live – unless the maintainer is you, in which case justice may be said to have been served! Much better, I think, to use an sprintf statement instead.

    >perl -wMstrict -le "my $books = [ qw(a b c) ]; my @body = qw(x y); my $Author2 = 'defoe'; ;; push @body, qq{<td rowspan=${\scalar @$books}>$Author2</td>}; push @body, sprintf qq{<td rowspan=%d>$Author2</td>}, scalar @$books; print qq{'$_'} for @body; " 'x' 'y' '<td rowspan=3>defoe</td>' '<td rowspan=3>defoe</td>'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973128]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (17)
As of 2015-07-07 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls