[13957] in Perl-Users-Digest
Perl-Users Digest, Issue: 1367 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 13 09:12:44 1999
Date: Sat, 13 Nov 1999 06:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942501910-v9-i1367@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 13 Nov 1999 Volume: 9 Number: 1367
Today's topics:
Re: A Big Thanks... <chris@chrismail.connectfree.co.uk>
bad header <chris@chrismail.connectfree.co.uk>
Re: bad header <moseley@best.com>
Re: cgi page instead of html (Abigail)
Re: cgi page instead of html (Abigail)
Re: cgi page instead of html <flavell@mail.cern.ch>
Re: Date Of Birth from TODAY <lr@hpl.hp.com>
Re: Date Of Birth from TODAY <Count.Zero*NO_SPAM*@anti-social.com>
Re: Generating pi (Abigail)
Re: Help needed fast please (Abigail)
Re: Help with Stoopid Nutscrape (Netscape) (Bart Lateur)
mod_perl: print() hanging problems. . <csbell@infinit.com>
Re: output a binary file to browser from perl script <lr@hpl.hp.com>
Re: output a binary file to browser from perl script (Bart Lateur)
Re: output a binary file to browser from perl script <flavell@mail.cern.ch>
Re: Perl Wizards (Abigail)
Strange Problems going on with DBD::Solid <anish@infotech.com>
Re: Time (Abigail)
Urgent: simple regexp question tigra@sky.deep.ru
Re: Urgent: simple regexp question (Bart Lateur)
Re: Urgent: simple regexp question (Martien Verbruggen)
Users uploading pics to a website. (JACULBERTS)
What format does DBI:CSV create a new table in? tony_123@my-deja.com
Re: Why does print only prints to STDOUT when <christopher.kuhi@stud.uni-muenchen.de>
Re: Why does print only prints to STDOUT when <christopher.kuhi@stud.uni-muenchen.de>
Re: Writing data to file on another server. <Count.Zero*NO_SPAM*@anti-social.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 13 Nov 1999 09:39:06 -0000
From: "Chris" <chris@chrismail.connectfree.co.uk>
Subject: Re: A Big Thanks...
Message-Id: <382d3fbb.0@news2.cluster1.telinco.net>
I aggree I've had tons of help and it's great
THANKS!
------------------------------
Date: Sat, 13 Nov 1999 09:35:55 -0000
From: "Chris" <chris@chrismail.connectfree.co.uk>
Subject: bad header
Message-Id: <382d3efd.0@news2.cluster1.telinco.net>
I keep getting told Bad header=: http://blsoftpart.hypermart.net/sign_up.pl
all the time even with corrections shown
--
Chris
chris@chrismail.connectfree.co.uk
www.bl-soft.com/chrissite
------------------------------
Date: Sat, 13 Nov 1999 05:46:34 -0800
From: Bill Moseley <moseley@best.com>
Subject: Re: bad header
Message-Id: <MPG.12970b93ad15157798986b@nntp1.ba.best.com>
Chris (chris@chrismail.connectfree.co.uk) seems to say...
> I keep getting told Bad header=: http://blsoftpart.hypermart.net/sign_up.pl
> all the time even with corrections shown
What's the problem? It tells you exactly what's wrong:
<quote>
Possible Reasons
The script you were trying to use is misconfigured in some way,
and cannot complete its task as it is meant to.
</quote>
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 13 Nov 1999 02:55:41 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: cgi page instead of html
Message-Id: <slrn82qa31.lmh.abigail@alexandra.delanet.com>
Dott Gabriele Gallacci (news@gallacci.com) wrote on MMCCLXIV September
MCMXCIII in <URL:news:80hg27$j02$1@nslave2.tin.it>:
;; Hello,
;; I need to substitute html page with my cgi generated one (with perl): how
;; can I do that?
The same way as you would do if you use FLOW-MATIC as your language.
It's not a Perl question.
;; Can I configure apache to start perl script when .html page are requested?
If you can configure it to start a FLOW-MATIC script, you can configure
it for a Perl script. If you can't configure it for a FLOW-MATIC script,
you can't configure it for a Perl script either.
It's not a Perl question.
;; I cannot use embedded perl.
I cannot use a goldfish.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 13 Nov 1999 02:57:56 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: cgi page instead of html
Message-Id: <slrn82qa79.lmh.abigail@alexandra.delanet.com>
www.www2.internetpros.com (mpm@unix2.megsinet.net) wrote on MMCCLXV
September MCMXCIII in <URL:news:slrn82pj0s.1c4.mpm@unix2.megsinet.net>:
::
:: A quicker solution (not necessarily better, but works especially well if the
:: programmer doesn't have administrative access to change httpd.conf) is to use
:: met tags to redirect the browser to the CGI script.
No, it doesn't work especially well. Meta refreshes are evil from the
readers point of view.
Unless the user uses them as an "brainless author" detector.
Followups set.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 13 Nov 1999 13:08:09 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: cgi page instead of html
Message-Id: <Pine.HPP.3.95a.991113130100.22918C-100000@hpplus01.cern.ch>
On Sat, 13 Nov 1999, www.www2.internetpros.com wrote:
(after a comprehensive quote that they seemingly hadn't understood)
> >On Fri, 12 Nov 1999, Dott Gabriele Gallacci wrote:
> >
> >> Can I configure apache to start perl script when .html page are requested?
> >I would offer more advice, but this is the wrong place,
> A quicker solution (not necessarily better, but works especially well if the
> programmer doesn't have administrative access to change httpd.conf)
This is the wrong place. You seemingly don't know about .htaccess.
And anyway, the questioner would not be likely to ask how to configure
Apache, if they didn't have the ability to do so.
> is to use
> met tags to redirect the browser to the CGI script.
Cargo-cult. That is a proprietary "refresh". In an HTTP context,
"Redirection" means something else, and is part of the open interworking
standard. Pretending otherwise is mischievous, maybe even malicious.
My new sig seems even more appropriate. f'ups set.
--
* Progress (n.): The process through which Usenet has evolved from
smart people in front of dumb terminals to dumb people in front of
smart terminals. -- obs@burnout.demon.co.uk
------------------------------
Date: Sat, 13 Nov 1999 01:00:17 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Date Of Birth from TODAY
Message-Id: <MPG.1296c87a79d66a1d98a1ef@nntp.hpl.hp.com>
In article <80j3a9$36f$1@nnrp1.deja.com> on Sat, 13 Nov 1999 07:17:30
GMT, Andrej <webmaster@beautiful-ladies.com> says...
...
> %dayOfBirth: 30
> %monthOfBirth: November
> %yearOfBirth: 1967
>
> I have received some ideas (see below), but it works if the month are
> specified as numbers, Ie. %monthOfBirth: 11
>
> Somebody has any ideas, how it can work if %monthOfBirth is specified
> by the letters, Ie. %monthOfBirth: November
...
> I feel it is necessary establish something eg.
> (1,2,3,4,5,6,7,8,9,10,11,12) = (January, February, March, April, May,
> June, July, August, September, October, November, December);
>
> However, I in impasse here...
> Please!!! Help!!! And thank you in advance!
You are right in your conjecture. What you need is a hash that
associates month names with numerical values:
my %name_to_num = (
January => 0,
February => 1,
...
December => 11,
);
Then use $name_to_mon{$month_name};
I deliberately offset the month numbers by one, because that is how most
of the Perl built-in functions use them.
You should learn more about hashes, because their effective use is
criticial in Perl. Look in perldata or a tutorial or a beginner's book.
> Andrej Kartashov
> --
> ><><><><><><><><><><><><><><><><><><><><><>><><><><><><><><><><
> >| 1+1 Lonely hearts Marriage agency
> >| E-mail forwarding & flower delivery in Bishkek, Kyrgyzstan
> >| MAILto:djusha@infotel.kg
> >| http://www.beautiful-ladies.com/ -or- http://1-lh.hypermart.net/
> ><><><><><><><><><><><><><><><><><><><><><>><><><><><><><><><><
Put a space after the two dashes, and if Deja.com lets them get through
most newsreaders won't copy your signature, because copying the entire
signature violates Netiquette. But it is so intriguing that I thought
I'd let it through again, for everyone to savor its mysteries.
It shouldn't be more than four lines in any case, so get rid of the
pretty borders.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 13 Nov 1999 09:05:03 GMT
From: CZ <Count.Zero*NO_SPAM*@anti-social.com>
Subject: Re: Date Of Birth from TODAY
Message-Id: <382D2753.C8CC695F@anti-social.com>
Hi!
Andrej wrote:
> I have many htm files with bio-data of peoples which I gradually, by
> hand
> add to data base
> In these bio-data are specified day, month and year of birth.
> In Woda's *.rec files it is submitted as:
>
> %dayOfBirth: 30
> %monthOfBirth: November
> %yearOfBirth: 1967
>
> I have received some ideas (see below), but it works if the month are
> specified as numbers, Ie. %monthOfBirth: 11
>
> Somebody has any ideas, how it can work if %monthOfBirth is specified
> by the
> letters, Ie. %monthOfBirth: November
I think you might be able to just use a hash. Something like:
#Set up a hash
my %months = (
'jan' => 1,
'feb' => 2,
'mar' => 3,
'apr' => 4,
#other months...
'dec' => 12,
);
my $monthofbirth = <STDIN>; #Get 'November' somehow (we use stdin...)
$monthofbirth =~ /^(...)/; #Use this match to store the first 3 letters
of month in
#special variable $1
my $month_key = lc ($1); #Switch 3 letters to lowercase so they will
match our hash
my $numerical_month = $months{$month_key}; #Retrieve the numerical value
from hash.
You should do some checking to see that $months{$month_key} is
actually defined but this should work.
HTH
CZ
------------------------------
Date: 13 Nov 1999 03:31:24 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Generating pi
Message-Id: <slrn82qc60.lmh.abigail@alexandra.delanet.com>
David Cassell (cassell@mail.cor.epa.gov) wrote on MMCCLXV September
MCMXCIII in <URL:news:382CBFF4.45075C8A@mail.cor.epa.gov>:
&& revjack wrote:
&& >
&& > revjack explains it all:
&& > :Anybody ever tool up an algorithm in perl to generate the
&& > :digits of pi?
&& >
&& > Um, I mean, an algorithm that will crank out the digits one
&& > after another, ad infinitum, without cheating like Abigail.
&&
&& If you don't like Yannick's algorithm, you can look up
&& 'spigot algorithms' and code it up yourself. I think there
&& was an article on them in the American Mathematical Monthly
&& about four years ago.
This one is quite fast, and will print out all the digits of pi:
perl -we 'print "3."; {redo if print int rand 10}'
It doesn't necessarely print them in order though.
Abigail
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 13 Nov 1999 02:08:00 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Help needed fast please
Message-Id: <slrn82q79k.lmh.abigail@alexandra.delanet.com>
Tad McClellan (tadmc@metronet.com) wrote on MMCCLXIV September MCMXCIII
in <URL:news:slrn82p1rd.234.tadmc@magna.metronet.com>:
..
.. Being of feeble mind, I throw as many reminders at myself
.. as possible, so I usually use
..
.. q''
..
.. for the empty string, instead of '' .
But that doesn't win at Perl golf.
!8
Not easily mistaken for something else, and only 2 chars like '' and "".
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 13 Nov 1999 09:59:27 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help with Stoopid Nutscrape (Netscape)
Message-Id: <382d3597.5598450@news.skynet.be>
Andrew Broadley wrote:
>HTML is fine, ive been doing html longer than perl, but I believe its a
>fault with the perl script I've done. I still dont understand why you need
>to put Context type: text/standard in (even though it is in there)
>> > When i print out on my perl script... IE is fine.. but Netscape only
>> > prints the HTML code... why is that ?
Actually, it's the reverse: NEtscape is fine, but IE ignores the
content-type header, and examines the content. Even if you did
print "Content-type: text/plain\n\n";
and then output your HTML, IE would still show it as a web page, not as
plain text as requested.
Sorry for the non-Perl related content, but I hate it when people
unrightfully say that "IE is fine, but Netscape screws up." We don't
want to encourage Microsoft to go further down this horrendous road.
--
Bart.
------------------------------
Date: Sat, 13 Nov 1999 06:46:49 -0500
From: Christian Bell <csbell@infinit.com>
Subject: mod_perl: print() hanging problems. .
Message-Id: <382D4FA9.FB1BBAA6@infinit.com>
Hello,
to go straight to the problem, I have certain timeouts with my perl
implementations. When the server pushes the layout to the client (using
$r->print($layout. .), the server always waits for the client to return
a succesful 'OK' that it has loaded the page correctly (this seems to be
the default behoviour of print() in Apache::Registry). However, when
there are multiple connections, there is a bottleneck. Is their a way
to force print() into "raw-dumping" to the client without anything being
acknowledged?
thanks,
/chris
-do the math yourself, p=vi.
------------------------------
Date: Sat, 13 Nov 1999 00:16:19 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: output a binary file to browser from perl script
Message-Id: <MPG.1296be329391b57c98a1ee@nntp.hpl.hp.com>
In article <slrn82q36c.1q2.efflandt@efflandt.xnet.com> on 13 Nov 1999
07:01:30 GMT, David Efflandt <efflandt@xnet.com> says...
...
> if (open(FILE,"$file")) {
What is the purpose of the quotes on $file?
> binmode FILE; # only needed for Win servers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PLEASE stop saying things like that, and just show the binmode() as a
matter of course! That is called 'writing portable Perl'.
And you forgot to 'binmode STDOUT;' also.
> print <FILE>; # prints complete file
But in a very inappropriate way. It reads the entire file into a list
of 'lines', even though there aren't any lines, then it prints the list.
my $buf;
print $buf while read FILE, $buf, 8192; # or whatever size
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 13 Nov 1999 11:13:26 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: output a binary file to browser from perl script
Message-Id: <382e4707.10061930@news.skynet.be>
Larry Rosler wrote:
>> binmode FILE; # only needed for Win servers
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>PLEASE stop saying things like that, and just show the binmode() as a
>matter of course! That is called 'writing portable Perl'.
Yes, of course.
But it is also a way of preventing whining comments like "why do I ned
it? It works on Unix without binmode()!". binmode() is a noop on both
Unix and Mac. It disables the special treatment of text files on DOS and
Win32. [I am not familiar with the platforms that weren't mentioned.]
How about:
binmode FILE; # noop on Unix servers
--
Bart.
------------------------------
Date: Sat, 13 Nov 1999 12:58:27 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: output a binary file to browser from perl script
Message-Id: <Pine.HPP.3.95a.991113124942.22918B-100000@hpplus01.cern.ch>
On 13 Nov 1999, David Efflandt wrote:
(excessive quoting now deleted. As a regular contributor you should
know better, honestly. The context is evidently CGI, if I'm not very
much mistaken.)
> if (open(FILE,"$file")) {
> binmode FILE; # only needed for Win servers
> print <FILE>; # prints complete file
> close FILE;
> } else {
> # print error message including $! and exit
> }
We seem to be missing the appropriate CGI headers prior to sending the
data. (Or different headers when sending the error message - I would
recommend sending an error status, as well as a content-type that's
appropriate for the error message.)
And I add my vote to the other points raised: take away the "s around
$file, and change the comment on the binmode to something like "for
portability". And you forgot to binmode STDOUT for sending the binary
data.
--
* Progress (n.): The process through which Usenet has evolved from
smart people in front of dumb terminals to dumb people in front of
smart terminals. -- obs@burnout.demon.co.uk
------------------------------
Date: 13 Nov 1999 03:34:41 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Perl Wizards
Message-Id: <slrn82qcc5.lmh.abigail@alexandra.delanet.com>
David H. Adler (dha@panix.com) wrote on MMCCLXIV September MCMXCIII in
<URL:news:slrn82oq37.d8v.dha@panix.com>:
~~ On Wed, 10 Nov 1999 16:55:16 -0800, David Cassell
~~ <cassell@mail.cor.epa.gov> wrote:
~~
~~ >But I don't consider myself a Perl wizard. Just a satisfied
~~ >customer. Abigail, Larry, Uri, Damian... They're wizards.
~~
~~ I'm a Perl Druid, if that's any help. :-)
I hope you live close to Central Park....
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 13 Nov 1999 00:12:47 -0800
From: "Anish Mehra" <anish@infotech.com>
Subject: Strange Problems going on with DBD::Solid
Message-Id: <382d1d7a$0$233@nntp1.ba.best.com>
Hi All,
I recently tried my luck with 'Solid' Database (www.solidtech.com) and
installed DBI (as 'root') along with the Database driver module -
DBD::Solid. Since then, I am getting strange error while trying to run the
script, on the command line, which connects to the 'Solid' database and
makes transaction. The following is the situation - I provide the following
input on the command line:
1) $ perl script.pl (Goes Successful; Pretty Good)
2) $ ./script.pl (Reports unable to load modules of DBD::Solid and that this
module might have not installed properly)
This bug makes my script fail to run by the web-server, defeating the whole
purpose. Does this error message mean that the module has not been
completely installed? Just to let you know, I installed this modules couple
of times and got the same problem. Further, I also need to include the PATH
of the directory from where the module was installed as 'root'.
Any ideas ??? Quite Curious as this has now taken away my sleepy nights.
May God Bless you.
Anish Mehra.
------------------------------
Date: 13 Nov 1999 03:36:06 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Time
Message-Id: <slrn82qcer.lmh.abigail@alexandra.delanet.com>
Christian Wix (christian@wix.dk) wrote on MMCCLXIV September MCMXCIII in
<URL:news:382C997A.37F84B90@wix.dk>:
() I have a web server in another time zone than I. I want to convert the
() time and date 6 hours forward. How do I do that very easy?
Rent a U-Haul and move.
Abigail
--
$_ = "\x3C\x3C\x45\x4F\x54";
print if s/<<EOT/<<EOT/e;
Just another Perl Hacker
EOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 13 Nov 1999 09:44:26 GMT
From: tigra@sky.deep.ru
Subject: Urgent: simple regexp question
Message-Id: <80jbtq$9dm$1@nnrp1.deja.com>
Hi!
I've got stuck with escapin '+' in perl regexps. Consider the code:
#!/usr/bin/perl
$string = 'M/B Pentium PA-2010+ <VIA586/ 585-512k>MMX ATX';
$pattern = 'PA-2010\+';
if($string =~ s|\b\Q$pattern\E\b||) {
print("$1\n");
}
This does nothing. Why? How can I extract exactly 'PA-2010+'? Not
PA-2010 or anything else.
Great thanks
Sergey.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 13 Nov 1999 11:22:53 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Urgent: simple regexp question
Message-Id: <382f47fd.10308159@news.skynet.be>
tigra@sky.deep.ru wrote:
>$pattern = 'PA-2010\+';
>
>if($string =~ s|\b\Q$pattern\E\b||) {
> print("$1\n");
>}
>
>This does nothing. Why? How can I extract exactly 'PA-2010+'? Not
>PA-2010 or anything else.
Several problems. A: print $pattern. You'll see there's a backslash in
there. "\Q" quotes that backslash too, so the regex tries to match a
backslash, which isn't there. B: you forgot the capturing parentheses,
so $1 is undefined. And C: there's no word boundary between '+' and ' '.
You might want to check out lookahead: it must be followed by whitespace
or end of string.
$string = 'M/B Pentium PA-2010+ <VIA586/ 585-512k>MMX ATX';
$pattern = 'PA-2010+';
print $string =~ /(\b\Q$pattern\E)(?=\s|$)/; # this prints $1
>Subject: Urgent: simple regexp question
I ignored that "Urgent". In fact, I hadn't seen it. Now that I do, it
annoys me.
--
Bart.
------------------------------
Date: 13 Nov 1999 12:40:53 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Urgent: simple regexp question
Message-Id: <slrn82qn3m.igg.mgjv@wobbie.heliotrope.home>
On Sat, 13 Nov 1999 11:22:53 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
> tigra@sky.deep.ru wrote:
>
[snip]
> >Subject: Urgent: simple regexp question
>
> I ignored that "Urgent". In fact, I hadn't seen it. Now that I do, it
> annoys me.
It made me decide to not answer to it, and just see if it was still
there tomorrow, hopefully without answers. Pity you missed it :)
Martien
--
Martien Verbruggen |
Interactive Media Division | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd. | but mean your mother.
NSW, Australia |
------------------------------
Date: 13 Nov 1999 14:00:27 GMT
From: jaculberts@aol.com (JACULBERTS)
Subject: Users uploading pics to a website.
Message-Id: <19991113090027.08206.00001242@ng-fi1.aol.com>
Hello,
I am trying to create a way in which users could upload a photo or pic
into my website. I was thinking of using just a form but it seems only
text is being accepted. I would like to have a setup whereby a user clicks
on a button and a screen comes up for them to ID the pic to be uploaded.
The pic would then be uploaded to my website. Does anyone know of
such a thing? Thanks.
------------------------------
Date: Sat, 13 Nov 1999 09:36:21 GMT
From: tony_123@my-deja.com
Subject: What format does DBI:CSV create a new table in?
Message-Id: <80jbel$941$1@nnrp1.deja.com>
Hi
I have been having some problems with DBI:CSV.
The problem is, if I write a program that creates and populates that
table then I can write a program that can successfully read that table
and output its contents. If however I create the input to the program
that just reads and then displays the table in vi then the program does
not work. When I look at each input file in vi with the
:set list
option (This shows any control characters in the file)
then both files appear identical, however if I do a checksum on each
file then it shows they are different.
Does anyone know what is going one?
Cheers
Tony
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 13 Nov 1999 00:31:20 +0100
From: "Chris Kuhi" <christopher.kuhi@stud.uni-muenchen.de>
Subject: Re: Why does print only prints to STDOUT when
Message-Id: <80ja61$t6v$1@sparcserver.lrz-muenchen.de>
>&run( "perl $my_other_perl $arg1 $arg2", "$logfile", "a message");
>
>sub run {
>my( $test, $log_file, $title ) = @_;
>my($result) = system("$cmd > $log_file");
Where does $cmd come from? Is it a global you haven't mentioned? If not,
running your script with a '-w' will point out uninitialized variables...
Chris
------------------------------
Date: Sat, 13 Nov 1999 10:16:58 +0100
From: "Chris Kuhi" <christopher.kuhi@stud.uni-muenchen.de>
Subject: Re: Why does print only prints to STDOUT when
Message-Id: <80ja9u$t73$1@sparcserver.lrz-muenchen.de>
Apologies for the duplicate posts. My newsreader reported failure to upload
the messages each time.
Chris
------------------------------
Date: Sat, 13 Nov 1999 09:16:06 GMT
From: CZ <Count.Zero*NO_SPAM*@anti-social.com>
Subject: Re: Writing data to file on another server.
Message-Id: <382D29EA.30B25B5@anti-social.com>
Hi!
Crawfishy wrote:
>
> I am writing a cgi script in perl that currently gets data from an html form
> and writes it to a data file. This works great but now I need the script to
> write the data to a file on another server.
If you have access to the other server's setup or are friendly with
the admin I think this might work:
1) Your script doesn't write to a file but emails the data to
whatever@otherserver.com
2) Otherserver.com has aliased the whatever@otherserver.com addr. to
"| yourperlscript"
3) yourperlscript resides on otherserver.com and writes the data to a
local file.
HTH
CZ
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 1367
**************************************