[9209] in Perl-Users-Digest
Perl-Users Digest, Issue: 2804 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 7 09:08:13 1998
Date: Sun, 7 Jun 98 06:01:17 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 7 Jun 1998 Volume: 8 Number: 2804
Today's topics:
Re: Am I looking at an anonymous array (Mike Heins)
Array help <flh@1st.net>
Re: Copy in Perl... (Jonathan Stowe)
Date fomatting. <Nick1pub@worldnet.att.net>
Re: Date fomatting. (John Stanley)
Re: Date fomatting. <Nick1pub@worldnet.att.net>
Re: Date fomatting. (John Stanley)
Re: Date fomatting. (Brian Lavender)
Re: DBM concurrent writing (Brian L. Matthews)
Re: decimal arithmetic (Chip Salzenberg)
How to install PERL with user account? <boomer@boomer.dk>
Re: How to install PERL with user account? (Bob Trieger)
HTTP Header Info bobbybooby@my-dejanews.com
Re: HTTP Header Info (Jonathan Stowe)
Internet Transfer Control?? <ctt@usa.net>
Re: Internet Transfer Control?? (Jonathan Stowe)
Re: Is PERL case sensitive? (Larry Rosler)
Re: Is PERL case sensitive? (Craig Berry)
Netmask and subnet comparisons in perl? (David Richards)
newbie ques: Here Documents <timlowe@u.washington.edu>
Re: newbie ques: Here Documents <angst@scrye.com>
Re: newbie ques: Here Documents (Jonathan Stowe)
Re: newbie ques: Here Documents (Michael J Gebis)
newbie question on pattern matching <xuchu@iscs.nus.edu.sg>
print with << (Brian Lavender)
Re: print with << (Mark Badolato)
Re: print with << (Mark Badolato)
Re: print with << <angst@scrye.com>
Re: print with << <rlogsdon@io.com>
Re: print with << (Michael J Gebis)
Re: print with << (Jonathan Stowe)
Re: Q: puzzled: regex with inperpolation <xah@shell13.ba.best.com>
SOLUTION to $ENV problem <zeos@gti.com>
Stop inputing date in array ("yuji sugawara")
Re: Stop inputing date in array (Jonathan Stowe)
Re: Switching PERL scripts from UNIX to NT- Help! <cnott@b-c-web.com>
unique file name zohar_amir@icomverse.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Jun 1998 06:45:56 -0500
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Am I looking at an anonymous array
Message-Id: <357a6f64.0@news.one.net>
Erland Sommarskog <sommar@algonet.se> wrote:
> THE SHORT QUESTION:
> If say "ref $x" I might get ARRAY or HASH in return. But can I tell
> whether this array or hash is a real variable, or just an anonymous
> entity?
> WHY ON EARTH DO I WANT TO DO THAT?
> In my MSSQL::Sqllib module there is this routine:
[snip]
> So I what would like to is on the inside sql_sp inspect my array and
> hash references to find out whether they refer to a named variable or
> an anonymous array/hash, so I only emit a warning when appropriate.
> Is this possible? Am I asking for a new feature? Or is my approach
> completely off the target from the beginning.
>
Just bless it and see if it has a package name in front.
@Main::Package::ref = 1;
my @ref;
@ref = 1;
$ref = [ 1 ];
for ( \@Main::Package::ref, \@ref, $ref) {
print "$_\n";
}
for ( \@Main::Package::ref, \@ref) {
bless $_;
print "$_\n";
}
Otherwise there would be no way to tell.
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
Just because something is 131 Willow Lane, Floor 2 | || _ \
obviously happening doesn't Oxford, OH 45056 | || |_) |
mean something obvious is <mikeh@minivend.com> |___| _ <
happening. --Larry Wall 513.523.7621 FAX 7501 |_| \_\
------------------------------
Date: Sun, 07 Jun 1998 02:21:18 -0400
From: "Francis L. Hartley" <flh@1st.net>
Subject: Array help
Message-Id: <357A315E.4B32@1st.net>
Hello all,
I know you guy's get a lot of foolish requests but, believe me I have
tried many other sources and I would not ask this if I were not
desperate.
I'm finishing up a homepage for a realtor and my last project is a
search engine. Th database is built and working fine. I also have a
search that works well but the interface is not user frendly.
I need to have a radio button beside a price range so the user does not
have to enter it. I understand what I need to do in the code but not
EXACTLY how to do it.
Please check out the page: http://www.webwave.com/redbud/
This is exactly what I want. All I really need to know is in the table
where the HTML calls for "value="" or 1, 2, etc for "price_range" could
someone give me an example?
Thanks I know this sounds pretty lame but I could really use the
advice...Thanks...
<tr>
<td align="right" width="100"><font
color="#C0C0C0"><input type="radio"
name="price_range" value="" checked></font></td>
<td align="center" width="250">Any Price</td>
</tr>
<tr>
<td align="right" width="100"><font
color="#C0C0C0"><input type="radio"
name="price_range" value="1"></font></td>
<td align="center" width="250">$0 - $50,000</td>
</tr>
------------------------------
Date: Sun, 07 Jun 1998 12:35:58 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Copy in Perl...
Message-Id: <357a83cd.8205465@news.btinternet.com>
On Sat, 06 Jun 1998 19:17:10 -0500, Uday Pai wrote :
>This is a multi-part message in MIME format.
>--------------2F1D687417872DB49EF399B6
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>
Aaargh. Dont do this in usenet postings it is only of any use to a
small minority of widely deprecated newsreaders.
>I have a file in dir1 and want to copy in dir2. I do not want to make a
>system call like
>
>system("copy C:\sdsd\dir1\file.txt C:\sd\dir2");
>
Beware of those slashes.
>I want a platform independent solution. Is there no function like copy()
>in perl. I could not find it anywhere.
>
Thats because there is no function lile copy() in perl.
However there is a module that comes with all recent distributions
called File::Copy.
perldoc File::Copy
It is always a good idea to examine the documentation before asking a
question here. A cursory glance at perltoc would have helped here.
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sun, 07 Jun 1998 11:58:55 -0400
From: Nick Nottleman <Nick1pub@worldnet.att.net>
Subject: Date fomatting.
Message-Id: <6ld345$k67@bgtnsc03.worldnet.att.net>
I am creating a script that polls to see if a file exists and then
e-mails it if it does exist. I have been able to make everything work
except that the files that I need to search for are created with the
current date in this format:
yymmdd
So I need to be able to make perl look for the file.
I have tried a bunch of things and the only thing that I even remotely
came close with was Time::CTime which gave me way too much info.
Sorry for posting a dumb question!
Thanks for any input in advance!
Nick
------------------------------
Date: 7 Jun 1998 04:06:43 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Date fomatting.
Message-Id: <6ld3kj$gb$1@news.NERO.NET>
In article <6ld345$k67@bgtnsc03.worldnet.att.net>,
Nick Nottleman <Nick1pub@worldnet.att.net> wrote:
>I am creating a script that polls to see if a file exists and then
>e-mails it if it does exist. I have been able to make everything work
>except that the files that I need to search for are created with the
>current date in this format:
>yymmdd
>So I need to be able to make perl look for the file.
Well, you might try the -e file test, or you might try opening the file
for read access. If the latter fails, you won't know if the file exists,
but if you can't open it for read it doesn't really matter if it exists,
you probably can't mail it to anyone anyway..
------------------------------
Date: Sun, 07 Jun 1998 12:13:51 -0400
From: Nick Nottleman <Nick1pub@worldnet.att.net>
Subject: Re: Date fomatting.
Message-Id: <6ld405$t0k@bgtnsc03.worldnet.att.net>
John Stanley wrote:
>
> In article <6ld345$k67@bgtnsc03.worldnet.att.net>,
> Nick Nottleman <Nick1pub@worldnet.att.net> wrote:
> >I am creating a script that polls to see if a file exists and then
> >e-mails it if it does exist. I have been able to make everything work
> >except that the files that I need to search for are created with the
> >current date in this format:
> >yymmdd
> >So I need to be able to make perl look for the file.
>
> Well, you might try the -e file test, or you might try opening the file
> for read access. If the latter fails, you won't know if the file exists,
> but if you can't open it for read it doesn't really matter if it exists,
> you probably can't mail it to anyone anyway..
I guess I should have phrased the question better, I can tell if the
file exists if I hard code it, but I need to assign some sort of
variable to look for these files every day. i.e
$filname = yymmdd
------------------------------
Date: 7 Jun 1998 04:47:33 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Date fomatting.
Message-Id: <6ld615$1dm$1@news.NERO.NET>
In article <6ld405$t0k@bgtnsc03.worldnet.att.net>,
Nick Nottleman <Nick1pub@worldnet.att.net> wrote:
>John Stanley wrote:
>> Well, you might try the -e file test, or you might try opening the file
>> for read access. If the latter fails, you won't know if the file exists,
>> but if you can't open it for read it doesn't really matter if it exists,
>> you probably can't mail it to anyone anyway..
>I guess I should have phrased the question better, I can tell if the
>file exists if I hard code it, but I need to assign some sort of
>variable to look for these files every day. i.e
>$filname = yymmdd
perldoc -f localtime
man date
Either should tell you enough to proceed.
------------------------------
Date: Sun, 07 Jun 1998 08:58:48 GMT
From: brian@brie.com (Brian Lavender)
Subject: Re: Date fomatting.
Message-Id: <357d4b36.26089308@news.jps.net>
[mailed, posted]
I am not sure if this answers your question. Maybe it is the spaceship
operator <> you are looking for. If I am correct about what you are
looking for, how about using stat? Here is a little script that tells
you Access Time, Modify Time, and Change Time for $foofile. It's even
Y2K compliant :) I would check out the Date module. I was too lazy to
pull out the docs for it and I just worked this using localtime.
brian
--------
Brian E. Lavender
http://www.brie.com/brian/
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster
#!/usr/local/bin/perl
$foofile = "/brian/proweb.asc";
@fileinfo = stat($foofile);
@months =
('January','February','March','April','May','June','July','August','September','October','November','December');
@days =
('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
@descriptors = ('Access Time','Modify Time','Change Time');
print "Stat times for $foofile\n\n";
for ($i=8 ; $i<=10; $i++){
print $descriptors[$i-8]," ";
@temp = localtime($fileinfo[$i]);
print $days[$temp[6]],' ',$months[$temp[4]],' ',$temp[3],', ',
1900+$temp[5];
print "\n";
}
On Sun, 07 Jun 1998 12:13:51 -0400, Nick Nottleman
<Nick1pub@worldnet.att.net> wrote:
>John Stanley wrote:
>>
>> In article <6ld345$k67@bgtnsc03.worldnet.att.net>,
>> Nick Nottleman <Nick1pub@worldnet.att.net> wrote:
>> >I am creating a script that polls to see if a file exists and then
>> >e-mails it if it does exist. I have been able to make everything work
>> >except that the files that I need to search for are created with the
>> >current date in this format:
>> >yymmdd
>> >So I need to be able to make perl look for the file.
>>
>> Well, you might try the -e file test, or you might try opening the file
>> for read access. If the latter fails, you won't know if the file exists,
>> but if you can't open it for read it doesn't really matter if it exists,
>> you probably can't mail it to anyone anyway..
>I guess I should have phrased the question better, I can tell if the
>file exists if I hard code it, but I need to assign some sort of
>variable to look for these files every day. i.e
>$filname = yymmdd
------------------------------
Date: 6 Jun 1998 21:40:50 -0700
From: blm@halcyon.com (Brian L. Matthews)
Subject: Re: DBM concurrent writing
Message-Id: <6ld5ki$kql$1@halcyon.com>
In article <3573B79A.428175F8@spanishbanner.com>,
webmaster <webmaster@spanishbanner.com> wrote:
|I had tryed to lock the file by using flock, but DBM changes on
|differents Perl versions an I think is not an orthodox method to do it
It is somewhat hackish, but if you specify a set of DBM routines to use
(instead of doing a dbmopen or using AnyDBM_File), the file or files used
shouldn't change, so you can flock one of the underlying files. This is
what I use, although I'd be happy to hear suggestions of other ways to
lock a DBM.
Brian
------------------------------
Date: Sat, 06 Jun 1998 23:07:55 GMT
From: chip@perlsupport.com (Chip Salzenberg)
Subject: Re: decimal arithmetic
Message-Id: <6lci79$inc$1@cyprus.atlantic.net>
According to tchrist@mox.perl.com (Tom Christiansen):
> $traceA= sprintf("%.${dp}g", $A);
> $traceB= sprintf("%.${dp}g", $B);
Or in 5.004+:
sprintf '%.*g', $dp, $A;
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Sun, 7 Jun 1998 14:27:12 +0200
From: "Boomer" <boomer@boomer.dk>
Subject: How to install PERL with user account?
Message-Id: <6le13i$b6b$1@dalen.get2net.dk>
Hello.
I would like to hear if it is possible to install PERL on the webserver, =
where my site is located?
It is a IIS server, and the so-called administrator simply can't figure =
out to setup PERL. (I've been waiting a month now).
So, is it possible for me to install PERL to my own directory, and start =
using the cool scripts?
--=20
Later
Boomer
ICQ UIN: 7613421
------------------------------
Date: Sun, 07 Jun 1998 12:41:50 GMT
From: voting.smoker@juicepigs.com (Bob Trieger)
Subject: Re: How to install PERL with user account?
Message-Id: <6le1um$5b4$2@strato.ultra.net>
[ posted and mailed ]
"Boomer" <boomer@boomer.dk> wrote:
-> Hello.
->
-> I would like to hear if it is possible to install PERL on the webserver, =
-> where my site is located?
->
-> It is a IIS server, and the so-called administrator simply can't figure =
-> out to setup PERL. (I've been waiting a month now).
Just get another ISP or keep your current ISP for connecting and rent your
webspace somewhere that has competent SYSops.
-> So, is it possible for me to install PERL to my own directory, and start =
-> using the cool scripts?
Not unless you have administrator access.
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
and hang up when the recording starts. "
------------------------------
Date: Sun, 07 Jun 1998 05:59:20 GMT
From: bobbybooby@my-dejanews.com
Subject: HTTP Header Info
Message-Id: <6lda7n$aov$1@nnrp1.dejanews.com>
Does anyone know how to do the following?
I'd like to control the address that appears in the browser address bar. I
have a site that draws the info from a flat files using perl and forms and
the resulting URL that appears in the Browser Address bar looks like
"http://www.servername.com/cgi-bin/script.pl?filename"
Is there a way to set the HTTP header information in the script to fool the
browser so it doesn't show all the garbage after the
"http://www.servername.com"? Kind of like
print FILEHANDLE Location:http://www.servername.com";
Thanks in advance
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Sun, 07 Jun 1998 12:35:56 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: HTTP Header Info
Message-Id: <357a81e7.7719049@news.btinternet.com>
On Sun, 07 Jun 1998 05:59:20 GMT, bobbybooby@my-dejanews.com wrote :
>Does anyone know how to do the following?
>
>I'd like to control the address that appears in the browser address bar. I
>have a site that draws the info from a flat files using perl and forms and
>the resulting URL that appears in the Browser Address bar looks like
>"http://www.servername.com/cgi-bin/script.pl?filename"
>
Eh,oh
Yes thats what happens when the HTTP request method is GET and this
will happen whatever language the CGI is written in. If you dont like
it you could always check in the documentation for your browser how to
hide the URL box.
>Is there a way to set the HTTP header information in the script to fool the
>browser so it doesn't show all the garbage after the
>"http://www.servername.com"? Kind of like
>
Ask in an appropriate newsgroup about how to use the POST method and
this isnt an appropriate newsgroup.
>print FILEHANDLE Location:http://www.servername.com";
>
What do you think that will achieve ?
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sun, 07 Jun 1998 16:54:48 +0800
From: Chu Tsz-Tat <ctt@usa.net>
Subject: Internet Transfer Control??
Message-Id: <357A5557.2FF02CD0@usa.net>
Do anybody know that how can perl do something that functions like the
'Internet Transfer Control' in VB?
Coz' I'd like to grab a html page from another server, do some analysis,
and then print out the modified html page together with the analysis.
If possible, please send me a copy of the source code.
Thanks a lot!!
------------------------------
Date: Sun, 07 Jun 1998 12:35:53 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Internet Transfer Control??
Message-Id: <357a78a9.5450152@news.btinternet.com>
On Sun, 07 Jun 1998 16:54:48 +0800, Chu Tsz-Tat wrote :
>Do anybody know that how can perl do something that functions like the
>'Internet Transfer Control' in VB?
>Coz' I'd like to grab a html page from another server, do some analysis,
>and then print out the modified html page together with the analysis.
Hmm, what answer did I give to this question last time ...
On Wed, 03 Jun 1998 20:46:20 GMT, Jonathan Stowe wrote :
>On Wed, 03 Jun 1998 20:36:04 GMT, Leonid A.Arcadiev wrote :
>
>> Can anybody advice how to write a spider in perl, that would check on a
>>website and read through its contents. If the responce has been received,
>>everything is fine, if no responce, generate an error message.
>> Please post a reply or send it to arcadiev@usa.net
>>
>
>Hmm theres a real vogue for this stuff right at this moment.
>
>There was a recent thread on something similar here:
>
>Subject: cron job via perl ??
>From: Kerem Yaman <kyaman@earthlink.net>
>Date: 1998/05/27
>Message-ID: <356CE415.4E0F9861@earthlink.net>
>Newsgroups: comp.lang.perl.misc
>
>which can be found on DejaNews.
>
Which probably contains all the useful answers.
>If possible, please send me a copy of the source code.
The LWP module has several examples.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 6 Jun 1998 20:13:13 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Is PERL case sensitive?
Message-Id: <MPG.fe3a5266f1e8b2a98968d@nntp.hpl.hp.com>
In article <Pine.BSI.3.96.980606193640.639B-100000@pentagon.io.com>,
rlogsdon@io.com says...
> On 5 Jun 1998, Martien Verbruggen wrote:
>
> > Subject: Is PERL case sensitive?
> >
> > Depends what you mean.
> >
> > It is perl for the program, Perl for the language. Never PERL.
> >
> > That is case sensitive. The program perl, and the language Perl are
> > both case sensitive as well. I don't really know about PERL.
>
> PERL is an acroynm for "Practical Extraction and Report Language". It's
> common practice to capitalize acronyms.
>
> Regards,
> Reuben Logsdon
Not when they achieve currency. For example, BASIC, COBOL and FORTRAN
are now universally Basic, Cobol and Fortran. And if it ever was PERL,
now it's Perl.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: 7 Jun 1998 07:37:24 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is PERL case sensitive?
Message-Id: <6ldfvk$t8b$2@marina.cinenet.net>
Larry Rosler (lr@hpl.hp.com) wrote:
: In article <Pine.BSI.3.96.980606193640.639B-100000@pentagon.io.com>,
: rlogsdon@io.com says...
: > PERL is an acroynm for "Practical Extraction and Report Language". It's
: > common practice to capitalize acronyms.
:
: Not when they achieve currency. For example, BASIC, COBOL and FORTRAN
: are now universally Basic, Cobol and Fortran. And if it ever was PERL,
: now it's Perl.
Yes, but poor C and C++ are still entirely uppercase. Blatant
discrimination, if you ask me. :-)
(And yes, I know C isn't an acronym. But also, FORTRAN wasn't an acronym
either, but rather a compression of 'FORmula TRANSlation'. Nor was COBOL,
actually a compression of COmmon Business Oriented Language. So perhaps
'ForTran' and CoBOL would be the proper names.)
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 7 Jun 1998 08:02:58 GMT
From: dr@ripco.com (David Richards)
Subject: Netmask and subnet comparisons in perl?
Message-Id: <6ldhfi$hnr$1@gail.ripco.com>
Keywords: subnet,netmask,addressing,Net::
I'm working on some simple software to generate IP filters, and was
wondering if anybody has code to check whether a given IP address is in the
subnet defined by a particular netmask?
IOW, given that I have a route to the subnet 10.0.2.2/28, I want to be able
to have the program decide whether the address 10.0.2.195 is in the range
already defined by the subnet, so I can avoid extra redundant rules in the
generated filters.
This seems like something that would belong under Net::Inet, but there
seems to be little subnet 'math' anwhere in CPAN.
I've already written the code to convert from the dotted-quad subnet
designation (e.g. '255.255.255.0' to '/24'), and could probably puzzle out
a way to handle the check for whether an address is within a given subnet,
but I always prefer to use standard libraries whenever possible.
Any assistance or a nudge in the right direction would be appreciated.
------------------------------
Date: Sat, 6 Jun 1998 23:56:51 -0700
From: "Timothy Lowe" <timlowe@u.washington.edu>
Subject: newbie ques: Here Documents
Message-Id: <6lddil$7ma$1@texas.nwlink.com>
I've just started learning Perl and have run across a problem. I am trying
to create a web page and am using the following code:
print "Content-type: text/html\n\n";
print<<"HTML";
<html>
<head><title>This is a Web Page</title></head>
<body>
<h2>Welcome to the Web Page</h2>
</body>
HTML
Here is the error I am getting:
Can't find string terminator "HTML" anywhere before EOF
If I instead write the above as:
print "Content-type: text/html\n\n";
print "<html>";
print "<head><title>This is a Web Page</title></head>";
print "<body>";
print "<h2>Welcome to the Web Page</h2>";
print "</body>";
It all works like a charm, but makes editing the html much more frustrating.
I got the code from a Perl 5 Dummies book and have tried looking for what
the Dummies author calls
"here documents" in the Perl docs that come with the Perl 5 archive with no
luck. So if anyone can give me a tip on what I did wrong or how I should
handle web page creation I would be quite a happy camper. Thanks for taking
the time to answer.
Tim Lowe
timlowe@u.washington.edu
------------------------------
Date: 7 Jun 1998 07:45:26 GMT
From: angst <angst@scrye.com>
Subject: Re: newbie ques: Here Documents
Message-Id: <6ldgem$mpt$2@jelerak.scrye.com>
Timothy Lowe <timlowe@u.washington.edu> wrote:
: I've just started learning Perl and have run across a problem. I am trying
: to create a web page and am using the following code:
: print "Content-type: text/html\n\n";
: print<<"HTML";
: <html>
: <head><title>This is a Web Page</title></head>
: <body>
: <h2>Welcome to the Web Page</h2>
: </body>
: HTML
: Here is the error I am getting:
: Can't find string terminator "HTML" anywhere before EOF
It's looking for the terminator "HTML". You gave it the terminator
HTML. When you're talking about labels, those two aren't
the same thing (i think). try replacing print <<"HTML" with
print <<HTML. Also, make sure the HTML on a line by itself is
not indented (ie, the H is the first character on the line).
--
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: Sun, 07 Jun 1998 12:35:51 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: newbie ques: Here Documents
Message-Id: <357a75dd.4733930@news.btinternet.com>
On 7 Jun 1998 07:45:26 GMT, angst wrote :
>Timothy Lowe <timlowe@u.washington.edu> wrote:
<snip>
>: Here is the error I am getting:
>: Can't find string terminator "HTML" anywhere before EOF
>
>It's looking for the terminator "HTML". You gave it the terminator
>HTML. When you're talking about labels, those two aren't
>the same thing (i think). try replacing print <<"HTML" with
>print <<HTML.
Nope. The quotes around the HTML are alright. They indicate the kind
of quoting that is to be used for the whole string. They could equally
be single quotes if you wanted the whole thing to be treated as a
single quoted string or backticks if the here document was a list of
commands to be execusted.
> Also, make sure the HTML on a line by itself is
>not indented (ie, the H is the first character on the line).
>
That is almost certainly the case. In certain unix shells you can
specify that white space be ignored at the beginning of the line
containing the terminator but this is not so in Perl.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 7 Jun 1998 07:54:57 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: newbie ques: Here Documents
Message-Id: <6ldh0h$fmk@mozo.cc.purdue.edu>
"Timothy Lowe" <timlowe@u.washington.edu> writes:
}I've just started learning Perl and have run across a problem. I am trying
}to create a web page and am using the following code:
} print "Content-type: text/html\n\n";
} print<<"HTML";
} <html>
} HTML
}Here is the error I am getting:
}Can't find string terminator "HTML" anywhere before EOF
Is that final HTML indented? It makes a difference. Try packing that
final HTML up against the left, or doing a print<<" HTML"; instead
and see what happens.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 7 Jun 1998 11:58:25 GMT
From: wings <xuchu@iscs.nus.edu.sg>
Subject: newbie question on pattern matching
Message-Id: <6ldv91$btn3@id4.nus.edu.sg>
what's the best debugger in perl now (for win32 platform)?
and btw, is there a 'readline' function that can read a line from
a file in perl? coz i want to do this now:
test file:
xxxx <TOPICS="YES" NEWID="1">
<TOPIC>wings</TOPIC>
asdjfas
xxxx <BODY>i am wings </BODY>
asdfas axxx <TOPICS="NO" NEWID="2">
xxxyyy <BODY>i am not wings </BODY>
i wanna extract only bodies if TOPICS="YES".. here is what i wrote:
use strict;
open (FP1,"test") || die "cannot open file\n";
$_ = join('\n',);
my $i = 0;
while ((/TOPICS="YES"/) && (s#NEWID="(\d+)"##si)) {
$i = $1;
s#(.*?)##si;
open (FP,"+>d:/tmp/r.".$i) or die "cannot open file to write.\n";
print FP "$1\n";
close (FP);
}
close(FP1);
seems there's some problems w/ my codes.. where's wrong? thx for
any enlightment.
--
wings
------
You cannot learn anything unless you almost know it already.
Email: xwings@usa.net, xuchu@iscs.nus.edu.sg
ICQ UIN: 1440319
http://gump.iscs.nus.edu.sg
------------------------------
Date: Sun, 07 Jun 1998 06:29:23 GMT
From: brian@brie.com (Brian Lavender)
Subject: print with <<
Message-Id: <357c32f1.19875598@news.jps.net>
I remember seeing where you could do something like
print << --theend--
My golly
miss
molly
--theend--
with print and it would print out
My golly
miss
molly
I can't get it to work and I can't find the answer in the Camel book.
What am I missing?
brian
--------
Brian E. Lavender
http://www.brie.com/brian/
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster
------------------------------
Date: 7 Jun 1998 00:49:01 -0700
From: bady@primenet.com (Mark Badolato)
Subject: Re: print with <<
Message-Id: <6ldgld$f1f@nntp02.primenet.com>
Rumor has it that brian@brie.com (Brian Lavender) wrote something to the effect of:
>I remember seeing where you could do something like
>
>print << --theend--
>My golly
>miss
>molly
>--theend--
It should be:
print <<__theend__;
My golly
miss
molly
__theend__
You had the right idea, just one [SHIFT] key short of perfection :)
--Mark
----------------------------
Mark Badolato -- bady@primenet.com
AOL Instant Message: cybrnx ICQ: 8602162
You can page me online at <URL:http://www.mirabilis.com/8602162> or by sending
me e-mail to 8602162@pager.mirabilis.com
------------------------------
Date: 7 Jun 1998 00:53:00 -0700
From: bady@primenet.com (Mark Badolato)
Subject: Re: print with <<
Message-Id: <6ldgss$f6m@nntp02.primenet.com>
Rumor has it that bady@primenet.com (Mark Badolato) wrote something to the effect of:
>You had the right idea, just one [SHIFT] key short of perfection :)
and a missing semicolon at the end of the print line...I missed that :)
--Mark
----------------------------
Mark Badolato -- bady@primenet.com
AOL Instant Message: cybrnx ICQ: 8602162
You can page me online at <URL:http://www.mirabilis.com/8602162> or by sending
me e-mail to 8602162@pager.mirabilis.com
------------------------------
Date: 7 Jun 1998 07:42:07 GMT
From: angst <angst@scrye.com>
Subject: Re: print with <<
Message-Id: <6ldg8f$mpt$1@jelerak.scrye.com>
Brian Lavender <brian@brie.com> wrote:
: I remember seeing where you could do something like
: print << --theend--
: My golly
: miss
: molly
: --theend--
: I can't get it to work and I can't find the answer in the Camel book.
: What am I missing?
a semicolon.
Try something like:
print <<EOF;
blah
blah
blah
EOF
--
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: Sun, 7 Jun 1998 02:56:01 -0500
From: REUBEN LOGSDON <rlogsdon@io.com>
To: Brian Lavender <brian@brie.com>
Subject: Re: print with <<
Message-Id: <Pine.BSI.3.96.980607025310.22611A-100000@pentagon.io.com>
Yes this works. In your case you would want:
print <<'--theend--';
basically add quotes (either single for no interpolation or double for
normal interpolation), then remove the whitespace before "--" and also add
a semicolon to the end of the print statement.
print <<'foo';
x
y
z
foo
will work
Regards,
Reuben Logsdon
On Sun, 7 Jun 1998, Brian Lavender wrote:
> I remember seeing where you could do something like
>
> print << --theend--
> My golly
> miss
> molly
> --theend--
>
> with print and it would print out
>
> My golly
> miss
> molly
>
> I can't get it to work and I can't find the answer in the Camel book.
> What am I missing?
>
> brian
> --------
> Brian E. Lavender
> http://www.brie.com/brian/
>
> With a PC, I always felt limited by the software available.
> On Unix, I am limited only by my knowledge.
> --Peter J. Schoenster
>
>
------------------------------
Date: 7 Jun 1998 07:50:55 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: print with <<
Message-Id: <6ldgov$fmd@mozo.cc.purdue.edu>
brian@brie.com (Brian Lavender) writes:
[Regarding here documents]
}I can't get it to work and I can't find the answer in the Camel book.
}What am I missing?
Go to dejanews and find the article with message ID
<6k3u68$r1l$2@csnews.cs.colorado.edu> and you will see several nifty
working examples courtesy T.C. himself. These may be more nifty than
you need, but you should be able to extract the answer you need. (In
particular, pay close attention to how you format things.)
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Sun, 07 Jun 1998 12:35:55 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: print with <<
Message-Id: <357a80f3.7474798@news.btinternet.com>
On Sun, 07 Jun 1998 06:29:23 GMT, Brian Lavender wrote :
>I remember seeing where you could do something like
>
>print << --theend--
>My golly
>miss
>molly
>--theend--
>
You are mssing a semicolon on the first line there, the space before
the terminator string will be interpreted as meaning that you want a
null terminator matching on the first blank line, also the use of a
Perl operator (--) as part of the terminator is asking for trouble.
Apart from that you're going in the right direction.
A point of style and readability really but the convention is to use
an uppercase label as the terminator.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 07 Jun 1998 01:53:00 -0700
From: Xah Lee <xah@shell13.ba.best.com>
Subject: Re: Q: puzzled: regex with inperpolation
Message-Id: <yo3solhr3tf.fsf@shell13.ba.best.com>
I'm further puzzled. Perhaps someone can help me out by answering the following question:
In the code:
my $str = 'xxxxxxxxxxxx';
my $patternString = q{(\Q.m\E|\Q.nb\E)$};
if ($str =~ m/${patternString}/) {print 'matched';} else {print 'no match';};
for what $str such that it will match?
Thanks for helping.
Xah, xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
Mountain View, CA, USA
>...
> \Q and \E work during interpolation, they have nothing to do with RE
> engine. m// implies interpolation. Both
>
> $var = q{FOO};
>
> and
>
> m/$var/
>
> do not interpolate FOO (first since you explicitly asked for it,
> second - since this would be *double* interpolation).
>
> A new qr// (Quote-as-in-Re) operator would have been available now,
> except for the strike of Perl developers. Then you could have used it
> instead of your q//.
>
> Hope this helps,
> Ilya
------------------------------
Date: Sun, 07 Jun 1998 00:20:22 -0400
From: David Wasserstrum <zeos@gti.com>
To: gellyfish@btinternet.com, sowmaster@juicepigs.com
Subject: SOLUTION to $ENV problem
Message-Id: <357A1506.73224E7D@gti.com>
It turns out that there is a known bug with the version of the Apache web
server that I was using that causes perl.exe to be called without any
environmental settings. This problem is supposed to be fixed in the next
release.
I just wanted to thank you for your time and help...
------------------------------
Date: Sun, 7 Jun 1998 11:50:12 +0900
From: yuji@dc4.so-net.ne.jp ("yuji sugawara")
Subject: Stop inputing date in array
Message-Id: <001101bd91bf3224de60ecd984d2@fmv>
I just start to learn perl as first langage for two weeks.
I have problem with my perl, that is I can't stop inputing data in array.
When I enter Ctrl+D, another character is returned.
Ctrl+Z or Ctrl+C make program ended.
Could someone help this bigginner?
I'm in Japan and use Fujitu FMV,
------------------------------
Date: Sun, 07 Jun 1998 12:36:00 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Stop inputing date in array
Message-Id: <357a8723.8940856@news.btinternet.com>
On Sun, 7 Jun 1998 11:50:12 +0900, "yuji sugawara" wrote :
>I just start to learn perl as first langage for two weeks.
>I have problem with my perl, that is I can't stop inputing data in array.
>When I enter Ctrl+D, another character is returned.
>Ctrl+Z or Ctrl+C make program ended.
Hmm, CTRL-D should work on most Unices and CTRL-Z on WinDos. But
there may a different EOF character on your system. Some systems
might require you to enter the line in which you typed ^[ZD] as the
keystrokes are not processed until then. I would suggest that you ask
a local expert.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 6 Jun 1998 21:43:12 -0700
From: "Chris" <cnott@b-c-web.com>
Subject: Re: Switching PERL scripts from UNIX to NT- Help!
Message-Id: <6ld5on$487$1@ash.ridgecrest.ca.us>
I have this same problem. What is the proper format of the hash/bang line?
My attempts at re-writing this script have produced 2 results.
1st - the browser does not interpret it as a script and displays the full
contents of the script in the browser window.
2nd - I get an error telling me my script did not return a valid set of
headers and that there is no such file or directory.
Forgive this newbie question, but, please, help!
------------------------------
Date: Sun, 07 Jun 1998 06:14:59 GMT
From: zohar_amir@icomverse.com
Subject: unique file name
Message-Id: <6ldb53$bhn$1@nnrp1.dejanews.com>
Hi, I am using a perl script to generate mail messages from HTML forms. The
mail system used is a Pegasus Mercury. I need to generate a file with the
mail message and put it in the SMTP Queue directory. In order to serve
multiple simultaneous users I need a way to give these mail files unique
names - how do I best do that for a file system which supports only short
file names (8.3) and for which the extension is fixed (it has to be '101')?
Please E-mail any suggestions to me at : zohar_amir@icomverse.com
Thanks,
Zohar
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2804
**************************************