[31423] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2675 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 14 00:14:18 2009

Date: Fri, 13 Nov 2009 21:14:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 13 Nov 2009     Volume: 11 Number: 2675

Today's topics:
        Syntax for Perl script <elopppoer@yughi.net>
    Re: Syntax for Perl script <sreservoir@gmail.com>
    Re: Syntax for Perl script <jimsgibson@gmail.com>
    Re: Syntax for Perl script <ben@morrow.me.uk>
    Re: Syntax for Perl script <tadmc@seesig.invalid>
    Re: Syntax for Perl script <elopppoer@yughi.net>
    Re: Syntax for Perl script <jurgenex@hotmail.com>
    Re: Syntax for Perl script <jurgenex@hotmail.com>
    Re: Syntax for Perl script <jurgenex@hotmail.com>
    Re: Syntax for Perl script <elopppoer@yughi.net>
    Re: Syntax for Perl script <elopppoer@yughi.net>
    Re: Syntax for Perl script <jurgenex@hotmail.com>
    Re: Syntax for Perl script <jurgenex@hotmail.com>
        test22 <nospam.gravitalsun@hotmail.com.nospam>
    Re: test22 <jurgenex@hotmail.com>
    Re: test22 <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 13 Nov 2009 19:32:02 -0600
From: bagman <elopppoer@yughi.net>
Subject: Syntax for Perl script
Message-Id: <aj1sf59htl6b9tnv5opvoqo5c03jkg51uc@4ax.com>

I'm not that familiar with Perl but am trying to enter a couple of
<br> into a perl script. It needs to go where this appears.

 if ($arg eq 'only') {
        print <<END;

I want to enter a couple of line breaks before the routine ends.
I've tried to enter it after the  {  using <br><br> and "<br><br>";
I've tried to use it using print "<br><br>"; with no luck.

I've tried to enter it after the print command in various ways with no
luck. Can someone tell me the correct syntax to enter a couple of line
breaks in the above code? Thanks. 


------------------------------

Date: Fri, 13 Nov 2009 20:52:19 -0500
From: sreservoir <sreservoir@gmail.com>
Subject: Re: Syntax for Perl script
Message-Id: <hdl2fk$h0r$1@aioe.org>

bagman wrote:
> I'm not that familiar with Perl but am trying to enter a couple of
> <br> into a perl script. It needs to go where this appears.
> 
>  if ($arg eq 'only') {
>         print <<END;
> 
> I want to enter a couple of line breaks before the routine ends.
> I've tried to enter it after the  {  using <br><br> and "<br><br>";
> I've tried to use it using print "<br><br>"; with no luck.
> 
> I've tried to enter it after the print command in various ways with no
> luck. Can someone tell me the correct syntax to enter a couple of line
> breaks in the above code? Thanks. 

print "\n\n";

perhaps?

-- 

   "Six by nine. Forty two."
   "That's it. That's all there is."
   "I always thought something was fundamentally wrong with the universe"


------------------------------

Date: Fri, 13 Nov 2009 18:00:32 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Syntax for Perl script
Message-Id: <131120091800325149%jimsgibson@gmail.com>

In article <aj1sf59htl6b9tnv5opvoqo5c03jkg51uc@4ax.com>, bagman
<elopppoer@yughi.net> wrote:

> I'm not that familiar with Perl but am trying to enter a couple of
> <br> into a perl script. It needs to go where this appears.
> 
>  if ($arg eq 'only') {
>         print <<END;
> 
> I want to enter a couple of line breaks before the routine ends.
> I've tried to enter it after the  {  using <br><br> and "<br><br>";
> I've tried to use it using print "<br><br>"; with no luck.
> 
> I've tried to enter it after the print command in various ways with no
> luck. Can someone tell me the correct syntax to enter a couple of line
> breaks in the above code? Thanks. 

The '<<END;' is a "here" document that generates a string starting with
the next line and continuing until an 'END' token appearing by itself
at the beginning of a line. It would have helped if you had shown us
the entire string or, better still, a complete program demonstrating
the problem. 

You should be able to add anything to be printed verbatim anywhere
between the 'print <<END'; line and the terminating 'END' line:

  if ($arg eq 'only') {
         print <<END;
<br><br>
 ...whatever else needs to be printed...
END

  }

-- 
Jim Gibson


------------------------------

Date: Sat, 14 Nov 2009 02:00:33 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Syntax for Perl script
Message-Id: <1jf1t6-b8a.ln1@osiris.mauzo.dyndns.org>


Quoth bagman <elopppoer@yughi.net>:
> I'm not that familiar with Perl but am trying to enter a couple of
> <br> into a perl script. It needs to go where this appears.

'<br>' is not valid Perl. I *suspect* you mean that you want to insert
the <br> into a HTML document the Perl program is supposed to print out,
but if so you need to be clear that is what you are doing. Getting
confused about which parts of the program are 'Perl code to be run' and
which parts are 'HTML data to be copied around' will make it impossible
for you to change anything sensibly.

>  if ($arg eq 'only') {
>         print <<END;
> 
> I want to enter a couple of line breaks before the routine ends.
> I've tried to enter it after the  {  using <br><br> and "<br><br>";
> I've tried to use it using print "<br><br>"; with no luck.

Please post a *short* *complete* script we can all run that demonstrates
your problem. You may wish to read the Posting Guidelines.

Ben



------------------------------

Date: Fri, 13 Nov 2009 20:08:52 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Syntax for Perl script
Message-Id: <slrnhfs44c.p9q.tadmc@tadbox.sbcglobal.net>

bagman <elopppoer@yughi.net> wrote:

> am trying to enter a couple of
><br> into a perl script.

    print "<br><br";

> I want to enter a couple of line breaks

    print "\n\n";


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Fri, 13 Nov 2009 20:21:14 -0600
From: bagman <elopppoer@yughi.net>
Subject: Re: Syntax for Perl script
Message-Id: <i94sf597hj59s6es31l4g2n0i15c3s8jg9@4ax.com>

On Fri, 13 Nov 2009 18:00:32 -0800, Jim Gibson <jimsgibson@gmail.com>
wrote:

>In article <aj1sf59htl6b9tnv5opvoqo5c03jkg51uc@4ax.com>, bagman
><elopppoer@yughi.net> wrote:
>
>> I'm not that familiar with Perl but am trying to enter a couple of
>> <br> into a perl script. It needs to go where this appears.
>> 
>>  if ($arg eq 'only') {
>>         print <<END;
>> 
>> I want to enter a couple of line breaks before the routine ends.
>> I've tried to enter it after the  {  using <br><br> and "<br><br>";
>> I've tried to use it using print "<br><br>"; with no luck.
>> 
>> I've tried to enter it after the print command in various ways with no
>> luck. Can someone tell me the correct syntax to enter a couple of line
>> breaks in the above code? Thanks. 
>
>The '<<END;' is a "here" document that generates a string starting with
>the next line and continuing until an 'END' token appearing by itself
>at the beginning of a line. It would have helped if you had shown us
>the entire string or, better still, a complete program demonstrating
>the problem. 
>
>You should be able to add anything to be printed verbatim anywhere
>between the 'print <<END'; line and the terminating 'END' line:
>
>  if ($arg eq 'only') {
>         print <<END;
><br><br>
>...whatever else needs to be printed...
>END
>
>  }

Thanks, sresovoir, but the --- print "\n\n"; --- didn't work.It didn't
generate an error though as all my other attempts have done.

Jim, I need the line breaks in the' if' section. Because if that
argument is not true it falls through to another section before the
END command. I only want the line breaks if the 'if' argument is true.
Here's the rest of the code. Thanks for the reply.

    if ($arg eq 'only') {
    	print <<END;

<br><div align="center"><a class="white"
href="javascript:history.back()">
Return to Vote</a></div>


END
    }
    print table_bottom();
    exit;
}
 


------------------------------

Date: Fri, 13 Nov 2009 18:31:54 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Syntax for Perl script
Message-Id: <ds2sf59k822nj7jqhd5af58v9ptmp7t57g@4ax.com>

bagman <elopppoer@yughi.net> wrote:
>I'm not that familiar with Perl but am trying to enter a couple of
><br> into a perl script. It needs to go where this appears.

You can't. Or rather it has no meaning to perl. <br> is an HTML element
and as far as Perl is concerned it is just good old plain boring text. 

> if ($arg eq 'only') {
>        print <<END;

The <<END is just a special way to quote some text.

>I want to enter a couple of line breaks before the routine ends.
>I've tried to enter it after the  {  using <br><br> and "<br><br>";

That hopefully gave you some syntax errors. As I mentioned, it is just
plain text and not valid Perl code.

>I've tried to use it using print "<br><br>"; with no luck.

That should have worked.

>I've tried to enter it after the print command in various ways with no
>luck. 

Depening upon what you mean by "after the print command" that should
have worked, too. 
The string ends with the corresponding END. Anything between those two
tags is part of the string and should have been printed to whereever
print() is set to print to.

>Can someone tell me the correct syntax to enter a couple of line
>breaks in the above code? 

Just two ways:

	if (1) {
	     print "This prints <BR>\n";
	     print <<END;
	As does this <BR>
	END
	}

Output:

	C:\Users\jue\tmp>t.pl
	This prints <BR>
	As does this <BR>

jue


------------------------------

Date: Fri, 13 Nov 2009 18:41:09 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Syntax for Perl script
Message-Id: <5p5sf5hm2okps4h29d7ite2l07qrge6hm4@4ax.com>

sreservoir <sreservoir@gmail.com> wrote:
>bagman wrote:
>> I've tried to enter it after the print command in various ways with no
>> luck. Can someone tell me the correct syntax to enter a couple of line
>> breaks in the above code? Thanks. 
>
>print "\n\n";
>
>perhaps?

Neat!

Or maybe just open the source in your favourite editor and hitting the
<ENTER> key a couple times.  Really highlights how not being aware of
the different levels causes confusion.

My suggestion above adds line breaks in the Perl source code, but
otherwise has (usually) no effect.

Your suggestion adds line breaks in the Perl output which probably also
happens to be the HTML source for some browser somewhere but will not
have any other effect..

What he is looking for however is probably to modify the generated HTML
code to so that it will produce some line break when viewed in a
browser, i.e. one more level of redirection.

jue


------------------------------

Date: Fri, 13 Nov 2009 18:48:13 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Syntax for Perl script
Message-Id: <3b6sf5lr5kq939sgcro203ijcqp22cme25@4ax.com>

bagman <elopppoer@yughi.net> wrote:
>On Fri, 13 Nov 2009 18:00:32 -0800, Jim Gibson <jimsgibson@gmail.com>
>wrote:
>
>>In article <aj1sf59htl6b9tnv5opvoqo5c03jkg51uc@4ax.com>, bagman
>><elopppoer@yughi.net> wrote:
>>
>>> I'm not that familiar with Perl but am trying to enter a couple of
>>> <br> into a perl script. It needs to go where this appears.
>>> 
>>>  if ($arg eq 'only') {
>>>         print <<END;
>>> 
>>> I want to enter a couple of line breaks before the routine ends.
>>> I've tried to enter it after the  {  using <br><br> and "<br><br>";
>>> I've tried to use it using print "<br><br>"; with no luck.
>>> 
>>> I've tried to enter it after the print command in various ways with no
>>> luck. Can someone tell me the correct syntax to enter a couple of line
>>> breaks in the above code? Thanks. 
>>
>>The '<<END;' is a "here" document that generates a string starting with
>>the next line and continuing until an 'END' token appearing by itself
>>at the beginning of a line. It would have helped if you had shown us
>>the entire string or, better still, a complete program demonstrating
>>the problem. 
>>
>>You should be able to add anything to be printed verbatim anywhere
>>between the 'print <<END'; line and the terminating 'END' line:
>>
>>  if ($arg eq 'only') {
>>         print <<END;
>><br><br>
>>...whatever else needs to be printed...
>>END
>>
>>  }
>
>Thanks, sresovoir, but the --- print "\n\n"; --- didn't work.It didn't
>generate an error though as all my other attempts have done.

???
There is no mentioning of print "\n\n"; anywhere in the text you quoted
above.
In any case, that does produce 2 line breaks in the generated Perl
output. Did you check it?

>Jim, I need the line breaks in the' if' section. Because if that
>argument is not true it falls through to another section before the
>END command. 


There is no END command! The <<END and END tokens are just enclosing a
here document. Think of them as fancy quote characters.

>I only want the line breaks if the 'if' argument is true.
>Here's the rest of the code. Thanks for the reply.
>
>    if ($arg eq 'only') {
>    	print <<END;
>
><br><div align="center"><a class="white"

You already got one <br> there. What is stopping you from adding two
more?

>href="javascript:history.back()">
>Return to Vote</a></div>
>
>
>END
>    }
>    print table_bottom();
>    exit;
>}
> 


------------------------------

Date: Fri, 13 Nov 2009 21:04:13 -0600
From: bagman <elopppoer@yughi.net>
Subject: Re: Syntax for Perl script
Message-Id: <mp6sf5docqje776pe6e5cg3g6mcnaa53m7@4ax.com>

On Fri, 13 Nov 2009 18:48:13 -0800, Jürgen Exner
<jurgenex@hotmail.com> wrote:

>>I only want the line breaks if the 'if' argument is true.
>>Here's the rest of the code. Thanks for the reply.
>>
>>    if ($arg eq 'only') {
>>    	print <<END;
>>
>><br><div align="center"><a class="white"
>
>You already got one <br> there. What is stopping you from adding two
>more?
>
>>href="javascript:history.back()">
>>Return to Vote</a></div>
>>
>>
>>END
>>    }
>>    print table_bottom();
>>    exit;
>>}
>> 

Jurgen, adding a line break there doesn't work because I'm working in
a limited space. If I add the <br> there it pushes 'Return to vote'
down and out of sight in the  iframe it is in. The 'if arg' is the
place to put it because at that point (if true)  it doesn't fall
through to the next line of code, it just ends the routine there and I
have my 2 line breaks. If it falls through the 2 line breaks aren't
added and the 'Return to vote' is OK (or that's the way I'm reading
the code). 

Nothing is working so I need to recheck and make sure I'm at the
correct location in the code. Thanks to all that replied and for all
your help. I may be back.


------------------------------

Date: Fri, 13 Nov 2009 21:08:08 -0600
From: bagman <elopppoer@yughi.net>
Subject: Re: Syntax for Perl script
Message-Id: <jl7sf51lucbfasr61tpu3oa0s41vpeals6@4ax.com>

On Fri, 13 Nov 2009 21:04:13 -0600, bagman <elopppoer@yughi.net>
wrote:

>Jurgen, adding a line break there doesn't work because I'm working in
>a limited space. If I add the <br> there it pushes 'Return to vote'
>down and out of sight in the  iframe it is in. The 'if arg' is the
>place to put it because at that point (if true)  it doesn't fall
>through to the next line of code, it just ends the routine there and I
>have my 2 line breaks. If it falls through the 2 line breaks aren't
>added and the 'Return to vote' is OK (or that's the way I'm reading
>the code). 
>
>Nothing is working so I need to recheck and make sure I'm at the
>correct location in the code. Thanks to all that replied and for all
>your help. I may be back.

Oh, forgot to mention that my problem only happens in IE8. FireFox 3.6
is working fine. 


------------------------------

Date: Fri, 13 Nov 2009 19:43:58 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Syntax for Perl script
Message-Id: <kg9sf5l3lq5rhb08qqirg5c3kdvuij3tfe@4ax.com>

bagman <elopppoer@yughi.net> wrote:
>On Fri, 13 Nov 2009 18:48:13 -0800, Jürgen Exner
[...]
>Jurgen, adding a line break there doesn't work because I'm working in
>a limited space. If I add the <br> there it pushes 'Return to vote'
>down and out of sight in the  iframe it is in. The 'if arg' is the
>place to put it because at that point (if true)  it doesn't fall
>through to the next line of code, it just ends the routine there and I
>have my 2 line breaks. If it falls through the 2 line breaks aren't
>added and the 'Return to vote' is OK (or that's the way I'm reading
>the code). 


What on earth are you talking about? You got basically 

	if ($arg eq 'only') {
    		print "Some HTML Code";
	}
	print table_bottom();
	exit;
	
>Nothing is working so I need to recheck and make sure I'm at the
>correct location in the code. Thanks to all that replied and for all
>your help. I may be back.

Now where again to you want to print those additional <BR>?
Not in the condition, I hope. That would be poor style.
In the true case? Well, that's what all the people told you how to do
it.
In the else/false case? Well, there is none.
After the conditional? Well, then just do so, before or after the print
table bottom() at your convenience.

jue


------------------------------

Date: Fri, 13 Nov 2009 19:45:16 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Syntax for Perl script
Message-Id: <ns9sf5pmq7v96213ktebkcr4msi3kkv5bt@4ax.com>

bagman <elopppoer@yughi.net> wrote:

>Oh, forgot to mention that my problem only happens in IE8. FireFox 3.6
>is working fine. 

Forgive me for asking, but given that information what exactly makes you
believe that you got a Perl problem?

jue


------------------------------

Date: Sat, 14 Nov 2009 00:09:36 +0200
From: "George Mpouras" <nospam.gravitalsun@hotmail.com.nospam>
Subject: test22
Message-Id: <hdklep$26ah$1@ulysses.noc.ntua.gr>

test22 


------------------------------

Date: Fri, 13 Nov 2009 14:16:37 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: test22
Message-Id: <cjmrf5p29h8nqacucqs7tsmic0rkj6puvq@4ax.com>

"George Mpouras" <nospam.gravitalsun@hotmail.com.nospam> wrote:
>test22 

Your test failed. 
Something in your news client or server must be seriously misconfigured
because your posting ended up in comp.lang.perl.misc instead of in one
of the many test NGs.

jue


------------------------------

Date: Fri, 13 Nov 2009 20:05:57 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: test22
Message-Id: <slrnhfs3ut.p9q.tadmc@tadbox.sbcglobal.net>

George Mpouras <nospam.gravitalsun@hotmail.com.nospam> wrote:
> test22 


killfile entry 51 for:

   % testers in non-test newsgroup
   Score:: -9998


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 2675
***************************************


home help back first fref pref prev next nref lref last post