[17591] in Perl-Users-Digest
Perl-Users Digest, Issue: 5011 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 1 18:05:42 2000
Date: Fri, 1 Dec 2000 15:05:12 -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: <975711912-v9-i5011@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 1 Dec 2000 Volume: 9 Number: 5011
Today's topics:
Re: activate <no-one@home.com>
Re: Anybody know what the carriage control characters a <gjchap99@my-deja.com>
Re: Anybody know what the carriage control characters a <mischief@velma.motion.net>
AUTOMATION rrknight@usgs.gov
Re: calling perl script in html? (Monte Phillips)
Can this script be done in a one-liner <dross@iders.ca>
Re: Can this script be done in a one-liner <jeffp@crusoe.net>
Definition of solid block symbol <gallantknave@my-deja.com>
Re: FAQ 4.30: How do I strip blank space from the beg (John Stanley)
file upload problem <me@privacy.net>
Re: file upload problem nobull@mail.com
Re: file upload problem dtbaker_dejanews@my-deja.com
Re: how do i escape from perldoc <joe+usenet@sunstarsys.com>
Re: how do i escape from perldoc <jeff@vpservices.com>
Re: how do i escape from perldoc <tony_curtis32@yahoo.com>
Re: how do i escape from perldoc <jeff@vpservices.com>
howto specify command line options <remi@multiweb.nl>
Improve code with RegEx <jean.zoch@utoronto.ca>
Re: Improve code with RegEx <johngros@Spam.bigpond.net.au>
Is there a function like LaTeX's \input ? <neil@utstat.utoronto.ca>
Re: need regular expression guru! <johngros@Spam.bigpond.net.au>
Re: need regular expression guru! <ren.maddox@tivoli.com>
Re: next if length < 80; # why can't Perl be made to r <brian+usenet@smithrenaud.com>
Re: Nice Perl 1-liner <elijah@workspot.net>
Re: passing !~ <ren.maddox@tivoli.com>
Pattern matching, I need a quick check. pjgratz@my-deja.com
Re: Pattern matching, I need a quick check. <joe+usenet@sunstarsys.com>
Re: Pattern matching, I need a quick check. <ren.maddox@tivoli.com>
Re: Pattern matching, I need a quick check. <elijah@workspot.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 01 Dec 2000 19:55:08 GMT
From: "fudge-sicle" <no-one@home.com>
Subject: Re: activate
Message-Id: <wmTV5.737639$8u4.12250857@news1.rdc1.bc.home.com>
figured it out
"fudge-sicle" <no-one@home.com> wrote in message
news:ivBV5.733234$8u4.12052887@news1.rdc1.bc.home.com...
> What if you are writing cgi files on a windows98 machine, then ftping them
> to a unix server? If I copy a file that works, and rename it to the
original
> and overwrite the orignal with it on the server it doesn't run anymore. I
> want to back up existing files to test but I can only seem to get the
> originals to run. I think I need somw way to make them executable on the
> Unix server.
>
> PS, I am a poor little VB programmer thrown into a very alien world.
Please
> be gentle, I have looked all over the FAQs I could find but nada!
>
> "Ed Grosvenor" <secursrver@hotmail.com> wrote in message
> news:htpV5.18005$II2.1782208@newsread2.prod.itd.earthlink.net...
> > Your question isn't exactly clear. What do you mean by two new pieces
of
> > Perl? Do you mean modules? Scripts that you have written? If Perl is
> > installed on that drive, then all you should have to do is specify the
> path
> > to Perl on the first line of your scripts (something like
> > !#usr/local/bin/perl). Then set the permissions on your script to 755
> > (that's chmod). If you're running on a Windows box, then don't worry
> about
> > the permissions. If your problem is something more complicated, like
Perl
> > isn't installed on your server or you need to add modules, then we'll
need
> > more information to help you.
> >
> > Good luck!
> > <neurofase@my-deja.com> wrote in message
> news:904i3j$5r6$1@nnrp1.deja.com...
> > > I am a complete newbie to perl. I first used it about a year ago. I
> > > have never written a perl form until now, but i have modified several.
> > >
> > > The set up that I have is that the webserver is just another drive on
> > > the netwrork. Whenever I created these 2 new pieces of perl I just
> > > transfered them onto the drive, but the dont work.
> > >
> > > I think i remember something about having to execute perl before it
> > > will work and you can do this by a FTP or Telnet program. The firewall
> > > here does not allow me to FTP or Telnet.
> > >
> > > Do I have to execute or activate the perl sections to get them to work
> > > and if so how would i do this considering they are only on another
> > > drive and not transfered through FTP or Telnet????
> > >
> > > Thanks
> > >
> > >
> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.
> > >
> >
> >
>
>
------------------------------
Date: Fri, 01 Dec 2000 21:21:27 GMT
From: Jack Altradmon <gjchap99@my-deja.com>
Subject: Re: Anybody know what the carriage control characters are ?
Message-Id: <9094oe$sqp$1@nnrp1.deja.com>
Can you run this snippet of code for me (on Win32 platform):
print " 0";
for (1..6000)
{
print "\ch" x 4;
printf ( "%4d", $_ );
}
This will show a 'real' time counter on screen - a bit basic but it
works.
It works on mine, so what is this \ch character ???
In article <slrn92fs7m.8pk.vek@pharmnl.ohout.pharmapartners.nl>,
vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse) wrote:
> On Thu, 30 Nov 2000 09:27:42 -0600, Michael Carman
<mjcarman@home.com> wrote:
>
> >
> >I don't know all of those, (and I don't think that a "move to end of
> >line" char even exists) but backspace is "\b" in Perl, and you can
use
> >"\f" (formfeed) to return to the beginning of the current line.
> >
>
> That would be '\r'. The result of formfeed is a bit undefied as there
> is no paper form to feed on a screen. Often the result is blanking
> the screen and start at the upper left corner.
>
> So
> \r do carriage return, that is return to start of same line.
> \n do line feed (should be the same char pos, but sometime as
> carriage return function is performed as well).
> \f eject the current page and load the next.
> \b move the print position one step backwards.
>
> Villy
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Dec 2000 22:11:09 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Anybody know what the carriage control characters are ?
Message-Id: <t2g8ftobotke8c@corp.supernews.com>
Jack Altradmon <gjchap99@my-deja.com> wrote:
> Can you run this snippet of code for me (on Win32 platform):
> print " 0";
> for (1..6000)
> {
> print "\ch" x 4;
> printf ( "%4d", $_ );
> }
> This will show a 'real' time counter on screen - a bit basic but it
> works.
> It works on mine, so what is this \ch character ???
q<\ch> is what the docs say it is... It's control-h, which is mapped
to backspace on many systems, which means it is a synonym for q<\b>
on those systems.
Since you're on Windows, you can try using control-m on a command
line, which will execute the command line, since q<\cm> is roughly
equivalent to end-of-line of DOS/Windows.
Chris
--
Christopher E. Stith - mischief@motion.net
"Carpe noctum."
------------------------------
Date: 1 Dec 2000 20:25:55 GMT
From: rrknight@usgs.gov
Subject: AUTOMATION
Message-Id: <9091gj$8mr$1@qvarsx.er.usgs.gov>
This is a multipart message in MIME format.
--=_alternative 00711B18862569A8_=
Content-Type: text/plain; charset="us-ascii"
I am new to PERL and I have searched through the FAQs and other info
sources before posting. How do you feed commands to a process that you
open with PERL? I am trying to automate several processes to speed up a
total process. What I need to do is open a program (windows based) and
then feed commands into it to get theprocess complete and then come back
to PERL and go to the next step. Some of the programs are like notepad
(commands like print, save, open). Thanks for any help.
Rodney Knight
U.S. Geological Survey
Tennessee
--=_alternative 00711B18862569A8_=
Content-Type: text/html; charset="us-ascii"
<br><font size=1 face="sans-serif">I am new to PERL and I have searched through the FAQs and other info sources before posting. How do you feed commands to a process that you open with PERL? I am trying to automate several processes to speed up a total process. What I need to do is open a program (windows based) and then feed commands into it to get theprocess complete and then come back to PERL and go to the next step. Some of the programs are like notepad (commands like print, save, open). Thanks for any help.</font>
<br>
<br><font size=1 face="sans-serif">Rodney Knight</font>
<br><font size=1 face="sans-serif">U.S. Geological Survey</font>
<br><font size=1 face="sans-serif">Tennessee</font>
--=_alternative 00711B18862569A8_=--
------------------------------
Date: Fri, 01 Dec 2000 21:30:38 GMT
From: montep@hal-pc.org (Monte Phillips)
Subject: Re: calling perl script in html?
Message-Id: <3a291845.8996085@news.hal-pc.org>
On Fri, 1 Dec 2000 12:22:00 -0000, "Geoff Winkless"
<geoff-at-farmline-dot-com@127.0.0.1> wrote:
>
>"Monte Phillips" <montep@hal-pc.org> wrote in message
>news:3a2782c9.3418906@news.hal-pc.org...
>: On Thu, 30 Nov 2000 01:53:50 GMT, joshbaxley <joshb@isomedia.com>
>: wrote:
>:
>: >I have a perl script that simply takes a list of files in a directory
>: >and lists them in html with links to them.
>: >
>: >Now if I did this in ASP and not perl and I wanted to call it in an HTML
>: >page, I would simply type:
>: >
>: ><!-- #LOCATION File:page.asp -->
>: >
>: >now how do I do this with perl?
>: >
>:
>:
>: If you want the perl script to run automatically without user
>: clicking, AND your ISP does not allow server side includes <-! Exec
>: etc. then the easiest method is to place your perl script as an image
>: src with 0 width and 0 heigth
>
>Yuck.
>
>Also this doesn't work in all browsers.
>
>Find a better way.
>Geoff
>
Well THAT comment was certainly helpful!!! If you know of a better
way to do it on ISP that do not allow SSI then enlighten us.
------------------------------
Date: Fri, 01 Dec 2000 22:22:57 GMT
From: Derek Ross <dross@iders.ca>
Subject: Can this script be done in a one-liner
Message-Id: <3A28242C.6598@iders.ca>
Hello,
Is it possible for this script to be compressed down into a one-liner?
All it does is read in two lists of integers from the files a.txt and
b.txt, and prints out the sum of each pair.
-----------------------
open(A, "a.txt");
open(B, "b.txt");
while(!eof(A))
{
$a = <A>;
$b = <B>;
print $a + $b . "\n";
}
-----------------------
Thanks,
Derek Ross
------------------------------
Date: Fri, 1 Dec 2000 17:36:11 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Can this script be done in a one-liner
Message-Id: <Pine.GSO.4.21.0012011729540.5826-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 1, Derek Ross said:
>All it does is read in two lists of integers from the files a.txt and
>b.txt, and prints out the sum of each pair.
perl -lne 'BEGIN { @A=<>, @ARGV="b.txt" } print shift(@A)+$_' a.txt
That reads the file a.txt into the array @A, then uses b.txt for the
implicit while (<>) { ... } loop around the program.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Fri, 01 Dec 2000 20:28:24 GMT
From: gallantknave <gallantknave@my-deja.com>
Subject: Definition of solid block symbol
Message-Id: <9091l1$q1b$1@nnrp1.deja.com>
Hello,
I've replaced newlines with <br> in a cgi script and when it shows up
in the file, I get a solid block followed by <br>. Can anyone tell me
what the symbol of a solid block stands for and why it happens?
As in: $item =~ s/\n/\<br\>/g;
--
I'm not a nay sayer, I'm just a fan.
Knave
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 1 Dec 2000 19:34:27 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: FAQ 4.30: How do I strip blank space from the beginning/end of a string?
Message-Id: <908ug3$nrr$1@news.NERO.NET>
In article <NOSV5.5$T3.170650112@news.frii.net>,
PerlFAQ Server <faq@denver.pm.org> wrote:
Can we please be consistent in who posts these? I try to filter these
redundant things out of the digest and it makes it very hard to do when
they show up from perlfaq-suggestions one time and faq the next.
>They serve to reduce the volume of
>redundant traffic on a news group by providing quality answers to
>questions that keep comming up.
Unless this material is already distributed with every copy of perl and
thus is redundant traffic all by itself.
>If you are some how irritated by
>seeing these postings you are free to ignore them or add the sender
>to your killfile.
Until the next time the sender is changed.
------------------------------
Date: Fri, 01 Dec 2000 19:22:19 GMT
From: "EM" <me@privacy.net>
Subject: file upload problem
Message-Id: <LTSV5.6274$Nw6.21153@news.iol.ie>
ok i made a html file and and a cgi to upload a file from users computer to
my server
the user clicks browse button and finds file and clicks submit
the problem is that the contents of the file is uploaded but not the
filename
so how do i get the filename?
i managed to use a javascript to send it as text but thats not very reliable
because many users turn off javascript
------------------------------
Date: 01 Dec 2000 20:10:17 +0000
From: nobull@mail.com
Subject: Re: file upload problem
Message-Id: <u9vgt3gaxi.fsf@wcl-l.bham.ac.uk>
"EM" <me@privacy.net> writes:
> ok i made a html file and and a cgi to upload a file from users computer to
> my server
> the user clicks browse button and finds file and clicks submit
>
> the problem is that the contents of the file is uploaded but not the
> filename
> so how do i get the filename?
The return value from param() method of CGI.pm when evaluated in a
string context is the the filename given by the client. If there's no
filename then I'd guess the client didn't give one.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 01 Dec 2000 20:16:01 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: file upload problem
Message-Id: <9090tr$p8o$1@nnrp1.deja.com>
In article <LTSV5.6274$Nw6.21153@news.iol.ie>,
"EM" <me@privacy.net> wrote:
> ok i made a html file and and a cgi to upload a file from users
computer to
> my server
> the user clicks browse button and finds file and clicks submit
>
> the problem is that the contents of the file is uploaded but not the
> filename
> so how do i get the filename?
-------------------------
actually you DO have it... Note that the
param('UploadFile'), or whatever name you use in your form, will be
BOTH a filename and an open FILEHANDLE.
D
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 01 Dec 2000 14:09:56 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: how do i escape from perldoc
Message-Id: <m3y9y0rm9n.fsf@mumonkan.sunstarsys.com>
vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse) writes:
> Tad McClellan <tadmc@metronet.com> wrote:
>
> > man more
> >
>
>
>
> The system in question probably uses "less" which requires you
> to use the 'q' key to quit.
>
> man less
That's more or less right.
--
Joe Schaefer
------------------------------
Date: Fri, 01 Dec 2000 11:36:28 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: how do i escape from perldoc
Message-Id: <3A27FDBC.F4BAD31C@vpservices.com>
Joe Schaefer wrote:
>
> vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse) writes:
>
> > Tad McClellan <tadmc@metronet.com> wrote:
> >
> > > man more
> >
> > man less
>
> That's more or less right.
Oh man!
--
Jeff
------------------------------
Date: 01 Dec 2000 13:43:59 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: how do i escape from perldoc
Message-Id: <877l5k0vwg.fsf@limey.hpcc.uh.edu>
>> On Fri, 01 Dec 2000 11:36:28 -0800,
>> Jeff Zucker <jeff@vpservices.com> said:
> Joe Schaefer wrote:
>> vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
>> writes:
>>
>> > Tad McClellan <tadmc@metronet.com> wrote: > > > man
>> more > > man less
>>
>> That's more or less right.
> Oh man!
Is that from PG Wodehouse?
--
Eih bennek, eih blavek.
------------------------------
Date: Fri, 01 Dec 2000 12:27:05 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: how do i escape from perldoc
Message-Id: <3A280999.DAFF4625@vpservices.com>
Tony Curtis wrote:
>
> On Fri, 01 Dec 2000 11:36:28 -0800,
> Jeff Zucker <jeff@vpservices.com> said:
>
>> Joe Schaefer wrote:
>
>>> vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse) writes:
>
>>>> Tad McClellan <tadmc@metronet.com> wrote:
>
>>>>> man more
>
>>>> man less
>
>>> That's more or less right.
>
>> Oh man!
>
> Is that from PG Wodehouse?
Beckett I think. At least he deals with garbage collection similarly to
the way Perl does.
--
Jeff
------------------------------
Date: Fri, 1 Dec 2000 23:11:58 -0000
From: "paul" <remi@multiweb.nl>
Subject: howto specify command line options
Message-Id: <7nVV5.4377$fy2.331751@news.soneraplaza.nl>
hi all
i have a question
i would like to specify commandline options in a perl script
for example ./test.pl -i <ip_addr> -h <host_name> etc etc
but i cant seem to find info on how to setup the options -i, -h
any help would be apreciated
grx paul
------------------------------
Date: Fri, 1 Dec 2000 20:54:36 GMT
From: "Jean" <jean.zoch@utoronto.ca>
Subject: Improve code with RegEx
Message-Id: <G4wq30.1Ku@campus-news-reading.utoronto.ca>
Hello,
I would like to use regular expressions to make this code better.
Right now, it steps through a string looking at each position and 3
positions ahead until it finds "body". It then sets $reached_body to true.
Then, it continues until it finds the character ">". I am using this code to
split a string that should contain the HTML tag <BODY> right after the ">".
The code then makes the two strings using substr.
Is there a better way (for sure!) to do this with regular expressions?
Thanks,
Jean
### MY CODE
# $line is a string that should contain an HTML <BODY> tag in it somewhere
$count = 0;
$not_done ="true";
$reached_body = "";
while ($not_done) {
# here we've reached the opening of the body tag
if (substr($line, $count,1) =~ /b/i && substr($line, $count +1,1) =~
/o/i && substr($line, $count +2,1) =~ /d/i && substr($line, $count +3,1) =~
/y/i ) {
$reached_body = "true";
}
# here we've reached the end of the body tag
if ($reached_body && substr($line, $count,1) =~ /\>/i) {
$not_done = "";
}
# this is added so we do not have an infinite loop if the HTML code is
too messed up for this simple program
if ($count == 8000) {
$not_done = "";
}
$count ++;
} # END WHILE
# now we make our 2 strings
$start = substr($line, 0, $count);
$end = substr($line, $count);
------------------------------
Date: Fri, 01 Dec 2000 22:57:20 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Improve code with RegEx
Message-Id: <k1WV5.914$xW4.7610@news-server.bigpond.net.au>
if ($line =~ /<BODY>/){
#$` is the string preceding the match, $& is the match
$String_A = $`.$&;
#$' is the string following the match
$String_B = $';
The punctuation is not that clear but maybe in different fonts to the one I
am using you could see the diff.
"Jean" <jean.zoch@utoronto.ca> wrote in message
news:G4wq30.1Ku@campus-news-reading.utoronto.ca...
> Hello,
>
> I would like to use regular expressions to make this code better.
>
> Right now, it steps through a string looking at each position and 3
> positions ahead until it finds "body". It then sets $reached_body to true.
> Then, it continues until it finds the character ">". I am using this code
to
> split a string that should contain the HTML tag <BODY> right after the
">".
> The code then makes the two strings using substr.
>
> Is there a better way (for sure!) to do this with regular expressions?
>
> Thanks,
> Jean
>
> ### MY CODE
>
> # $line is a string that should contain an HTML <BODY> tag in it somewhere
>
> $count = 0;
>
> $not_done ="true";
> $reached_body = "";
>
> while ($not_done) {
>
> # here we've reached the opening of the body tag
> if (substr($line, $count,1) =~ /b/i && substr($line, $count +1,1) =~
> /o/i && substr($line, $count +2,1) =~ /d/i && substr($line, $count +3,1)
=~
> /y/i ) {
> $reached_body = "true";
> }
>
> # here we've reached the end of the body tag
> if ($reached_body && substr($line, $count,1) =~ /\>/i) {
> $not_done = "";
> }
>
> # this is added so we do not have an infinite loop if the HTML code is
> too messed up for this simple program
> if ($count == 8000) {
> $not_done = "";
> }
>
> $count ++;
> } # END WHILE
>
> # now we make our 2 strings
> $start = substr($line, 0, $count);
> $end = substr($line, $count);
>
>
>
------------------------------
Date: Fri, 1 Dec 2000 21:24:09 GMT
From: Neil Montgomery <neil@utstat.utoronto.ca>
Subject: Is there a function like LaTeX's \input ?
Message-Id: <3A2816F9.1FC5E039@utstat.utoronto.ca>
I would like to split up a Perl program into several parts, for ease
of editing. Making my own modules would be overkill in my situation.
Is there a Perl function which will insert the contents of a file into
the code (like the LaTeX function \input)?
As a trivial example, suppose I had a file called "foo" containing the
single line:
my($x) = 1;
and I had a Perl program called "bar" consisting of:
#/usr/bin/perl -w
use strict;
is_there_such_a_function('foo');
print "$x\n";
Is there such a function that would insert the file "foo" so that
"bar" would actually run?
Regards,
Neil Montgomery
neil@utstat.toronto.edu
------------------------------
Date: Fri, 01 Dec 2000 20:43:15 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: need regular expression guru!
Message-Id: <D3UV5.850$xW4.6891@news-server.bigpond.net.au>
I think a two line regex might do it for you.
$body =~ s/<left>/$leftinsert_start/g;
$ body =~ s/<\/left>/$leftinsert_end/g;
<fhinchey@my-deja.com> wrote in message news:908oi7$hle$1@nnrp1.deja.com...
> I'm trying to do a find and substituion in a text file. The text file
> constains tab delimted columns representing an article. the first field
> contains the articles title, the second the body text. Within the body
> I have created a special tag "<left></left>" to indicate an image to be
> left aligned with the body text. (I have similar tags for right and
> center aligning).
>
> I need a regular expression to find the instances of the "left" tag,
> and replace them with HTML table text, keeping the stuff between the
> tags (i.e. the image name). I've been fooling around with some code but
> haven't had much luck. Any help would be much appreciated. Thanks!
>
> -Frank
>
> $file1 = 'article.txt';
> open(INFO, $file1) || die "can't open $file1: $!";
>
> $leftinsert_start = "<Table cellpadding=4 cellspacing=0 border=0
> align=left><tr><td>";
> $leftinsert_end = "</td></tr></Table>";
>
> while ($entry=<INFO>) {
> ($title, $body) = split ("\t", $entry);
>
> $body =~ s/ ( [<left>] .+ ) / ($leftinsert_start) \1
> ($leftinsert_end) /g;
>
> }
>
> print (qq{Content-type: text/html\n\n<html>
>
> $body
>
> });
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 01 Dec 2000 14:34:42 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: need regular expression guru!
Message-Id: <m3n1ef284d.fsf@dhcp11-177.support.tivoli.com>
fhinchey@my-deja.com writes:
> I'm trying to do a find and substituion in a text file. The text file
> constains tab delimted columns representing an article. the first field
> contains the articles title, the second the body text. Within the body
> I have created a special tag "<left></left>" to indicate an image to be
> left aligned with the body text. (I have similar tags for right and
> center aligning).
>
> I need a regular expression to find the instances of the "left" tag,
> and replace them with HTML table text, keeping the stuff between the
> tags (i.e. the image name). I've been fooling around with some code but
> haven't had much luck. Any help would be much appreciated. Thanks!
The *good* solution, is to use something HTML::Filter to do this.
The quick-and-dirty solution is probably to just ignore the fact that
these tags are paired. Just substitute "<left>" with the start of the
table and then substitute "</left>" with the end of the table --
separately.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Fri, 01 Dec 2000 18:02:26 -0500
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: next if length < 80; # why can't Perl be made to recognize this?
Message-Id: <brian+usenet-CFCFF1.18022601122000@news.panix.com>
In article <u966l4gfej.fsf@wcl-l.bham.ac.uk>, nobull@mail.com wrote:
> "next if length < 80;"
>
> If I stick my finger after the < you cannot tell if it is the opening
> of a <FILE> operator or a numerical comparison.
>
> Perl guesses wrong.
Perl doesn't guess wrong - we just don't think like Perl. ;)
--
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 1 Dec 2000 19:54:55 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Nice Perl 1-liner
Message-Id: <eli$0012011448@qz.little-neck.ny.us>
In comp.lang.perl.misc, Tad McClellan <tadmc@metronet.com> wrote:
> Georg Woeste <gbw@theo1.physik.uni-stuttgart.de> wrote:
> >I am using this nice Perl program, which fits in one line.
> >Perhaps it is well known, then forget this message, but I
> >found it very appealing, to wirte a non trivial program in
> >one line without using any variables!
> ^^^^^^^^^^^^^
> >shell> perl -e "print grep {(/BEGIN/) .. (/END/)} <>;" file.text
> That code _does_ use variables.
[snip bit about $_ used implicitly]
Really fun is not using any punctuation:
perl -ne "print scalar reverse unless m Z foobar Zix"
Elijah
------
perl -e 's Y Yreverse q N ny pm srekcah lrep kroy wen emosNYex and s Pmp ynP
P and s MsMjust sMx and print and s NYPM MPYN Nis or reverse and print q qq'
------------------------------
Date: 01 Dec 2000 14:30:32 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: passing !~
Message-Id: <m3r93r28bb.fsf@dhcp11-177.support.tivoli.com>
Uri Guttman <uri@sysarch.com> writes:
> >>>>> "PRL" == Phil R Lawrence <prlawrence@lehigh.edu> writes:
> PRL> # Please replace the '_not boo_' part
> PRL> $regex = qr/ _not boo_ /;
>
> use negative lookahead.
>
> $regex = qr/(?!.*_not boo_)/;
You need to anchor that or it will always match:
$regex = qr/^(?!.*_not boo_)/;
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Fri, 01 Dec 2000 19:46:32 GMT
From: pjgratz@my-deja.com
Subject: Pattern matching, I need a quick check.
Message-Id: <908v6m$nml$1@nnrp1.deja.com>
I am trying to manipulate the popwatch script and Im not sure its doing
the correct pattern matching for my syslog.
Pattern.
if(/^([A-Za-z]+\s+\d+\s+\d+\:\d+\:\d|).+POP login for \"(.+)\".+\s
(\d+\.\d+\.\d+.\d+).*$/)
Syslog.
Dec 1 14:45:46 raven qpopper[27915]: (v3.1) POP login for "bob" at
(laptop) 192.168.200.105
Thanks in advance,
-Pete
pete@raventech.net
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 01 Dec 2000 15:49:01 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Pattern matching, I need a quick check.
Message-Id: <m3sno7sw8y.fsf@mumonkan.sunstarsys.com>
pjgratz@my-deja.com writes:
> I am trying to manipulate the popwatch script and Im not sure its doing
> the correct pattern matching for my syslog.
>
> Pattern.
overly detailed s/|/+/ greedy?
vvvvvvvvvvvvvvvvvvvvvvv v vv
> if(/^([A-Za-z]+\s+\d+\s+\d+\:\d+\:\d|).+POP login for \"(.+)\".+\s
> (\d+\.\d+\.\d+.\d+).*$/)
^ ^^^
backslash? useless
I'm not familiar with "the popwatch script", but this regexp looks
like it "should" match (the seconds are wrong, though).
> Syslog.
>
> Dec 1 14:45:46 raven qpopper[27915]: (v3.1) POP login for "bob" at
> (laptop) 192.168.200.105
It seems to match the syslog line you sent.
What do your results show?
--
Joe Schaefer
------------------------------
Date: 01 Dec 2000 14:43:53 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Pattern matching, I need a quick check.
Message-Id: <m3itp327p2.fsf@dhcp11-177.support.tivoli.com>
pjgratz@my-deja.com writes:
> I am trying to manipulate the popwatch script and Im not sure its doing
> the correct pattern matching for my syslog.
Why do you think that?
> if(/^([A-Za-z]+\s+\d+\s+\d+\:\d+\:\d|).+POP login for \"(.+)\".+\s
> (\d+\.\d+\.\d+.\d+).*$/)
This is fine (well, escaping the colons is pointless and having an
empty alternation is a strange way to make the timestamp optional, but
it works).
> Dec 1 14:45:46 raven qpopper[27915]: (v3.1) POP login for "bob" at
> (laptop) 192.168.200.105
Assuming I remove the newlines from both the expression and the
string, the above expression matches this string just fine. And it
pulls out the correct pieces as well.
The problem must be somewhere else.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 1 Dec 2000 22:54:47 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Pattern matching, I need a quick check.
Message-Id: <eli$0012011752@qz.little-neck.ny.us>
In comp.lang.perl.misc, Ren Maddox <ren.maddox@tivoli.com> wrote:
> pjgratz@my-deja.com writes:
> > if(/^([A-Za-z]+\s+\d+\s+\d+\:\d+\:\d|).+POP login for \"(.+)\".+\s
> > (\d+\.\d+\.\d+.\d+).*$/)
> This is fine (well, escaping the colons is pointless and having an
> empty alternation is a strange way to make the timestamp optional, but
> it works).
Well, some people might consider it a problem that only one digit
of the seconds is matched.
Elijah
------
perl -wle '$_ = Just_Another_Perl_Hacker; tr/_/ /; print'
------------------------------
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 5011
**************************************