[22945] in Perl-Users-Digest
Perl-Users Digest, Issue: 5165 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 2 00:06:10 2003
Date: Tue, 1 Jul 2003 21:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 1 Jul 2003 Volume: 10 Number: 5165
Today's topics:
ASP --> PERL SCRIPT HELP>>PLEASE>> <jessanik@rogers.com>
Re: Automatic page forwarding in cgi perl script <REMOVEsdnCAPS@comcast.net>
Re: Automatic page forwarding in cgi perl script <jurgenex@hotmail.com>
Re: Delete array element from inside function <jaspax@u.washington.edu>
Re: doing 'ref' on blessed reference (Jay Tilton)
Re: doing 'ref' on blessed reference <no@spam.net>
Re: doing 'ref' on blessed reference <no@spam.net>
Re: doing 'ref' on blessed reference <mgjv@tradingpost.com.au>
generating executables <rhodri@phreaker.net>
Re: generating executables <xaonon@hotpop.com>
Re: generating executables <rhodri@phreaker.net>
Re: generating executables <jurgenex@hotmail.com>
Re: How to deal with Debug information in a large progr <bwalton@rochester.rr.com>
Re: How would you mail yourself from XP <wsegrave@mindspring.com>
Re: looking for Win32::OLE examples (automating Lotus 1 <bwalton@rochester.rr.com>
Re: Not following "if" <eric-amick@comcast.net>
Re: Problem with tk and displaying on the screen <bwalton@rochester.rr.com>
regular expression <thecommissioner@hotmail.com>
Re: regular expression <nknight@runawaynet.com>
Re: regular expression <mgjv@tradingpost.com.au>
Re: regular expression <thecommissioner@hotmail.com>
Re: regular expression <mgjv@tradingpost.com.au>
Re: SHIFT not shuffling ? (stu7)
Upgrading from 5.6.0 to 5.8.0 - module problem <demonnews@NOSPAMPLEASEbix.cc>
Re: Upgrading from 5.6.0 to 5.8.0 - module problem (Greg Bacon)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 Jul 2003 00:12:26 GMT
From: "kalusalu" <jessanik@rogers.com>
Subject: ASP --> PERL SCRIPT HELP>>PLEASE>>
Message-Id: <KrpMa.38291$2ay.28126@news01.bloor.is.net.cable.rogers.com>
Hello..I was browsing thru the newsgroups ...and was wondering if anyone
here can be of assistance to me....as I am very very new to PERL..and have
this ASP SCRIPT..I have to convert...
<%
'Response.Content.Type = "text/plain"
vpath = Request("vpath")
IF vpath = "" then
vpath = "/"
END IF
realPath = server.mappath(vpath)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(realPath)
response.write f.Size & vbcrlf
response.write.realPath & vbcrlf
response.write vpath & vbcrlf
%>
it outputs the following:
34342323423 D:\www-roots\www.example.com.80/wwwroot/
the diskusage the real path the virtual path
I have written this..
# $d = det_dir_name();
$size = 0;
DIR = opendir $d
While (readdir DIR) {
next if /^\.\.?$/ ;
next if -d$_;
$size == -s $_;
}
print $size
print $d
cannot find a function for this det dir name...any ideas..and how I convert
this ASP SCRIPT ????
------------------------------
Date: Tue, 01 Jul 2003 18:10:07 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Automatic page forwarding in cgi perl script
Message-Id: <Xns93ABC301740D7sdn.comcast@206.127.4.25>
maximuszen@optonline.net (Max) wrote in
news:3a9c1232.0307011216.d004957@posting.google.com:
> print ("Location:
> http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html\n\n");
>
> Why won't this work?
My car is a blue '95 Subaru with four doors.
Why won't it start?
--
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
------------------------------
Date: Wed, 02 Jul 2003 01:48:29 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Automatic page forwarding in cgi perl script
Message-Id: <NRqMa.68$C43.41@nwrddc04.gnilink.net>
Max wrote:
> print ("Location:
> http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html\n\n");
>
> Why won't this work?
Works just fine for me.
It prints the text
Location:
http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html
to STDOUT. Did you expect it to do anything else?
jue
------------------------------
Date: Tue, 1 Jul 2003 16:51:57 -0700
From: JS Bangs <jaspax@u.washington.edu>
Subject: Re: Delete array element from inside function
Message-Id: <Pine.A41.4.55.0307011647380.70698@dante18.u.washington.edu>
Brian McCauley sikyal:
> JS Bangs <jaspax@u.washington.edu> writes:
>
> > I've got a function that would like to be able to delete an array element
> > from an array in the caller's scope, given only the array element (not the
> > array itself, or a reference to it). The idea is to have something that
> > duplicates the functionality of delete(), but which tacks a bit of
> > other processing onto it.
>
> Short answer is you can't.
>
> Slightly longer answer is defined(prototype("CORE::delete")) is false
> meaning that the inbuilt delete() cannot be simulated by a subroutine.
Which also means that delete() is not goto-able, as a simple test
revealed. Well, drat. That was my last hope.
> > Unfortunately, this does not work. $word[3] remains firmly in place with a
> > defined value. What can I do to make this work?
>
> You cannot, you need to avoid wanting to do it.
It sure looks like I do.
>
> Without more background I can't be sure, but at a guess I'd say you
> appear to be trying to work arround the misconception that Perl
> doesn't have destructors.
Nah, I'm not worried about object destruction. The kink here is that I
often want to "delete" a segment object, but "deletion" can take the form
of actually delete()-ing it, or in clearing all of its values, depending
on context. I was hoping to have a function that would do both and so
avoid me having to think about the difference.
Jesse S. Bangs jaspax@u.washington.edu
http://students.washington.edu/jaspax/
http://students.washington.edu/jaspax/blog
Jesus asked them, "Who do you say that I am?"
And they answered, "You are the eschatological manifestation of the ground
of our being, the kerygma in which we find the ultimate meaning of our
interpersonal relationship."
And Jesus said, "What?"
------------------------------
Date: Tue, 01 Jul 2003 22:08:37 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: doing 'ref' on blessed reference
Message-Id: <3f01fe05.854571490@news.erols.com>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
: On Tue, 01 Jul 2003 03:48:14 GMT,
: Jay Tilton <tiltonj@erols.com> wrote:
: > JT <woland99@earthlink.net> wrote:
: >
: >: If we do 'ref' on blessed reference it return string that is the name of
: >: the class
: >
: > You may find Scalar::Util::blessed() more useful for that.
:
: Why?
Just a preference. ref() can return either a package name or a
reference type. blessed() is less ambiguous in its response.
------------------------------
Date: Tue, 1 Jul 2003 18:45:40 -0700
From: "Michael" <no@spam.net>
Subject: Re: doing 'ref' on blessed reference
Message-Id: <hNqMa.1180$jk4.132285@news.uswest.net>
Uhuh.
--
- JMM
"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrnbg2cgm.3er.mgjv@verbruggen.comdyn.com.au...
> Please, in the future, put your reply _after_ the suitably trimmed
> text. Also, don't quote text after your signature. Decent newsreading
> software will automatically remove signatures, which means that the
> old text is no longer included in the thread.
>
> On Mon, 30 Jun 2003 23:36:08 -0700,
> Michael <no@spam.net> wrote:
> > Is this a joke? Obviously, it doesn't answer the question and seems a
bit
> > sarcastic...
>
> No. it is not a joke. As far as I know, it answers the question. I
> interpreted the OP's question how they could find out what the
> underlying data structure was for a blessed object. My post answered
> that question.
>
> In which way do you think my post missed the point?
>
> Martien
> --
> |
> Martien Verbruggen | My friend has a baby. I'm writing down all
> Trading Post Australia | the noises the baby makes so later I can ask
> | him what he meant - Steven Wright
------------------------------
Date: Tue, 1 Jul 2003 18:45:54 -0700
From: "Michael" <no@spam.net>
Subject: Re: doing 'ref' on blessed reference
Message-Id: <wNqMa.1181$jk4.132070@news.uswest.net>
Nope. Sorry, Marty.
--
- JMM
"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrnbg2cl2.3er.mgjv@verbruggen.comdyn.com.au...
> On Mon, 30 Jun 2003 23:36:08 -0700,
> Michael <no@spam.net> wrote:
> > Is this a joke? Obviously, it doesn't answer the question and seems a
bit
> > sarcastic...
>
> Ah. You were actually responding to my other post in the same thread.
> See what happens if you don't quote articles correctly?
>
> Read my post again. Then read the answer it followed up to. Did you
> try to run the code? Did you see the result? Do you now understand why
> I posted?
>
> Martien
> --
> |
> Martien Verbruggen |
> Trading Post Australia | 42.6% of statistics is made up on the spot.
> |
------------------------------
Date: 02 Jul 2003 01:50:28 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: doing 'ref' on blessed reference
Message-Id: <slrnbg4ej5.3er.mgjv@verbruggen.comdyn.com.au>
[Sorry for the missing context. Mr anonymous Michael insists on
posting in a broken manner.]
On Tue, 1 Jul 2003 18:45:54 -0700,
Michael <no@spam.net> wrote:
> Nope. Sorry, Marty.
Well, you obviously will never learn, then.
*plonk*
Martien
--
|
Martien Verbruggen |
Trading Post Australia | values of Beta will give rise to dom!
|
------------------------------
Date: Wed, 02 Jul 2003 00:39:30 +0100
From: rod <rhodri@phreaker.net>
Subject: generating executables
Message-Id: <bdt63a$5qo$1@news8.svr.pol.co.uk>
hi, i posted this question in alt.perl a week or two ago but no
response, wonder if anyone here can help...
i have written a compiler in perl (for my shit language, it's just for
fun) and i have been outputting pseudo assembler instructions to a text
file which i can then run on my own lil virtual machine (just things
like LDA, ADD, etc... simple simple)
that all works fine, but i was wondering how one would go about creating
real executables? can you do this from perl? does anyone have any
pointers to resources that would help? anything would be great.
thanx.
rod.
------------------------------
Date: Tue, 01 Jul 2003 23:51:01 GMT
From: Xaonon <xaonon@hotpop.com>
Subject: Re: generating executables
Message-Id: <slrnbg4i44.oig.xaonon@xaonon.local>
Ned i bach <bdt63a$5qo$1@news8.svr.pol.co.uk>, rod <rhodri@phreaker.net>
teithant i thiw hin:
> that all works fine, but i was wondering how one would go about creating
> real executables? can you do this from perl? does anyone have any
> pointers to resources that would help? anything would be great.
Try "man perlcompile".
--
Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
Visit The Nexus Of All Coolness (i.e. my site) at http://xaonon.dyndns.org/
"Remember, kids! Don't try to stop Russians from picking mushrooms! Or
they'll nuke you!" -- James "Kibo" Parry, in alt.religion.kibology
------------------------------
Date: Wed, 02 Jul 2003 01:15:56 +0100
From: rod <rhodri@phreaker.net>
Subject: Re: generating executables
Message-Id: <bdt87n$5qo$2@news8.svr.pol.co.uk>
ok i looked at that and i know about perlcc and other ways of compiling
perl into executables, but that's not what i mean. forgive me here if
i've missed the point of ur reply, i'm sorry. what i want to do is
write my own executables not for my perl source but for the language i'm
parsing (a language i made up). am i making sense? can the B and O
modules help me with this or did i not make myself that clear in my
first post.
thanx anyway.
rod.
Xaonon wrote:
> Ned i bach <bdt63a$5qo$1@news8.svr.pol.co.uk>, rod <rhodri@phreaker.net>
> teithant i thiw hin:
>
>
>>that all works fine, but i was wondering how one would go about creating
>>real executables? can you do this from perl? does anyone have any
>>pointers to resources that would help? anything would be great.
>
>
> Try "man perlcompile".
>
------------------------------
Date: Wed, 02 Jul 2003 01:55:48 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: generating executables
Message-Id: <EYqMa.72$C43.23@nwrddc04.gnilink.net>
rod wrote:
> hi, i posted this question in alt.perl a week or two ago but no
> response, wonder if anyone here can help...
> i have written a compiler in perl (for my shit language, it's just for
> fun) and i have been outputting pseudo assembler instructions to a
> text file which i can then run on my own lil virtual machine (just
> things like LDA, ADD, etc... simple simple)
> that all works fine, but i was wondering how one would go about
> creating real executables? can you do this from perl? does anyone
> have any pointers to resources that would help? anything would be
> great.
This really has little to do with Perl but much more with how compilers and
interpreters work.
What you have right now is a compiler from your toy language into your toy
assembler (no offence intended). And then you got an interpreter for your
toy assembler (your lil virtual machine).
What you need is a true compiler or assembler, which can translate your toy
assembler code into the actual machine instructions suitable for your
hardware (plus the integration pieces for the OS).
Of course this compiler can be implemented in Perl, just like in pretty much
any other language.
Another and probably easier option would be to bundle the toy interpreter
with the assembler code into a self-executable package, such that the OS
would start the interpreter which in turn would automatically begin
executing the bundled piece of toy assembler code.
jue
------------------------------
Date: Tue, 01 Jul 2003 23:35:59 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: How to deal with Debug information in a large program.
Message-Id: <3F021ADA.2020306@rochester.rr.com>
Franklin Lee wrote:
> Hi All,
>
> I'm in trouble with Debug information in a large program.
> Some info I just want to print in degug phase.
> Now I do as follow:
> ###########################################################
> ...
> use vars qw($Debug);
> $Debug ||= 0;
>
> ...
> #Define option -D
> $Debug=1 if(defined($opt{'D'});
>
> ...
> #Print Debug info when necessary
> if($Debug) {
> print("Debug:xxxxxx\n");
> }
> ############################################################
>
> Do you think it's a good way to deal with Debug info.
> Or do you have a better way to deal with it?
>
> Any suggestions are welcome!
...
> Franklin
Another possible approach is:
use Filter::Simple;
to make a source code filter which will include or exclude debug
statements, which would be statements that start with a flag like
perhaps "#db ". The filter would simply remove the "#db " if debugging
is desired; otherwise, those statements would just be commentary, and
wouldn't normally be compiled or executed -- and you don't have to do
the clumsy if($Debug){...} bit. One could get fancy and include debug
levels with stuff like #db1 , #db2 , etc.
--
Bob Walton
------------------------------
Date: Tue, 1 Jul 2003 19:36:04 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: How would you mail yourself from XP
Message-Id: <bdt9pj$g5r$1@slb5.atl.mindspring.net>
"Helgi Briem" <helgi@decode.is> wrote in message
news:3f015a97.693720203@news.cis.dfn.de...
> On Mon, 30 Jun 2003 14:45:40 -0700, "zoo" <mee@home.com> wrote:
>
> >I use this piece of code to mail myself but my operating system can't
find
> >the mail command.
> >How would I make this command work with windows XP ?
> >
> >open MAIL, "|mail zoo@/hotmail.com";
should be
open MAIL, "|mail zoo\@hotmail.com";
> > print MAIL "bad news: $somename guessed $someguess\n";
> > close MAIL;
> >
Note to OP: With the above correction (and a bit of other help to make it a
complete script), the code you posted works fine on the Linux system to
which I ported it.
> >
> >'mail' is not recognized as an internal or external command,
> >operable program or batch file.
>
This is true.
You *could* get the code to work after a fashion with the |mail process
filehandle by writing a batch file, mail.bat, invoking msimn.exe, the
Outlook Express executable program, with the appropriate command line
parameters. Perl does indeed launch msimn.exe successfully in this case and
can even feed the command line params to the batch file, starting Outlook
Express, with the params stuffed in the right places. OTOH, that's about as
far as the success goes, as the process filehandle really doesn't function
correctly as a filehandle.
The following code (fragment) works on this Win32 (Win95SR1) workstation
open MAIL, "|mail $email $message";
with mail.bat invoking msimn.exe
msimn.exe /mailurl:mailto:%1?body=%2
That said (written), my recommendation is that you abandon the idea of using
a Perl process filehandle with Windows, as there are several much simpler
alternatives that use throroughly tested CPAN modules.
> I wouldn't use an external 'mail' program.
Note to OP: Use Mime::Lite, as suggested by Mr. Briem. You will no doubt
find it to be an expedient and pleasing solution.
Cheers.
Bill Segraves
------------------------------
Date: Tue, 01 Jul 2003 23:16:31 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: looking for Win32::OLE examples (automating Lotus 123 and Approach)
Message-Id: <3F02164A.7000003@rochester.rr.com>
Bryan Castillo wrote:
> JT <woland99@earthlink.net> wrote in message news:<3F01C903.5050109@earthlink.net>...
...
> If you have ActiveState installed in C:\perl look at
>
> C:\Perl\html\OLE-Browser\Browser.html
Those attempting this should note that success requires two things:
First, PerlScript must be installed, and second, you must use a recent
version of Internet Explorer -- other browsers won't work. Without both
of those, you will just get a bunch of blank frames with no indication
of why.
...
>>JT
--
Bob Walton
------------------------------
Date: Tue, 01 Jul 2003 23:06:41 -0400
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: Not following "if"
Message-Id: <hti4gvo5sqcc6h7dh78851nskubqc6r7bk@4ax.com>
On Tue, 01 Jul 2003 23:29:10 +0200, Stefan Glimne <Snygg@gmx.net> wrote:
>Well, I have now tested "exists", and it does not help. And there is
>nothing wrong with the code (exept that I forgot to show where I get the
>value $filmid. $filmid is stored like this:
>
>.....
>if ($line eq "##########") {
> $line = <INDATA>;
> chop $line;
> ($key,$filmid) = split(" = ", $line);
>} else {
> ($key,$value) = split(" = ", $line);
> $key2 = $filmid . '_' . $key;
>.....
I have no idea where this code goes in relation to what you've already
posted, but I'll ask anyway: How does $filmid get a value if the else
clause is executed?
--
Eric Amick
Columbia, MD
------------------------------
Date: Wed, 02 Jul 2003 00:22:16 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Problem with tk and displaying on the screen
Message-Id: <3F0225B3.1080404@rochester.rr.com>
Brian Helterline wrote:
> "derek / nul" <abuse@sgrail.org> wrote in message
> news:q2g3gvka9ougjqmk7ejjhvga0n8b7hhbmj@4ax.com...
...
> This is a nasty little feature of Windows (or any case-insensitive OS)
> When it looks for the file to 'use', it succeeds since the OS is doing
> the searching in a case-insensitive manner. When perl looks for the
> functions
> that were imported, it does it itself in a case-sensitive manner and fails!
>
> Anyone know of a way to fix this?
use Linux;-)
>
> -brian
--
Bob Walton
------------------------------
Date: Wed, 2 Jul 2003 12:18:52 +1000
From: "dj" <thecommissioner@hotmail.com>
Subject: regular expression
Message-Id: <3f02410e$0$30568$afc38c87@news.optusnet.com.au>
Hi,
I am writing a script that parses an html file (which has been retrieved as
a scalar by LWP::UserAgent). The script looks for everything in between the
first <P> tag and the last </P> tag, with any number of <P> and </P> tags in
between. I am sure I have done something like this before, but for the life
of me I can't remember how... (maybe i did it before in lex). Anyone got
any neato suggestions?
Thanks for any help,
Drew
------------------------------
Date: Tue, 01 Jul 2003 19:54:07 -0700
From: Nicholas Knight <nknight@runawaynet.com>
Subject: Re: regular expression
Message-Id: <bdthgf$10je22$1@ID-132594.news.dfncis.de>
on Tuesday 01 July 2003 07:18 pm, dj <thecommissioner@hotmail.com> wrote
in <3f02410e$0$30568$afc38c87@news.optusnet.com.au>:
> Hi,
> I am writing a script that parses an html file (which has been retrieved
> as
> a scalar by LWP::UserAgent). The script looks for everything in between
> the first <P> tag and the last </P> tag, with any number of <P> and </P>
> tags in
> between. I am sure I have done something like this before, but for the
> life
> of me I can't remember how... (maybe i did it before in lex). Anyone
> got any neato suggestions?
Are you looking for //s ? It makes '.' match newlines, too. I'd probably
do it like this (the 'i' to ignore case, as some people capitalize all
tags and some don't):
/<p>(.*)<\/p>/si
--
Nicholas Knight <nknight@runawaynet.com>
------------------------------
Date: 02 Jul 2003 03:02:47 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: regular expression
Message-Id: <slrnbg4iqp.1ge.mgjv@verbruggen.comdyn.com.au>
On Wed, 2 Jul 2003 12:18:52 +1000,
dj <thecommissioner@hotmail.com> wrote:
> Hi,
> I am writing a script that parses an html file (which has been retrieved as
> a scalar by LWP::UserAgent). The script looks for everything in between the
> first <P> tag and the last </P> tag, with any number of <P> and </P> tags in
> between. I am sure I have done something like this before, but for the life
> of me I can't remember how... (maybe i did it before in lex). Anyone got
> any neato suggestions?
Get HTML::Parser from CPAN, or depending on what you actually want to
do with the stuff, one of the other modules that grok HTML.
A _very_ simpleminded approach could do this:
my ($stuff) = /<P>(.*)</P>/i;
This will pull out everything before the first occurence of <P> or <p>
and the last occurence of </P> or </p>. Note that this is NOT the same
as the first P _tag_. Whenever <P> or </P> appears in a comment or
string, it will also match that. That is why you need something that
understands HTML, instead of simple regular expressions.
Maybe something like HTML::TreeBuilder is what you're looking for,
maybe with HTML::DOMbo. At least you get a reasonably sane handle on
the nodes instead of having to deal with weird HTML yourself.
Martien
--
|
Martien Verbruggen | The world is complex; sendmail.cf reflects
Trading Post Australia | this.
|
------------------------------
Date: Wed, 2 Jul 2003 13:10:40 +1000
From: "dj" <thecommissioner@hotmail.com>
Subject: Re: regular expression
Message-Id: <3f024d3a$0$8262$afc38c87@news.optusnet.com.au>
Hi Nicholas,
yep, i had something along these lines,
while ($_ =~ s/.+<P>(.+)<\/P>.+/$1/gsi) {
print;
}
but no sub occurs. I have tried a few combinations, but no match :)
"Nicholas Knight" <nknight@runawaynet.com> wrote in message
news:bdthgf$10je22$1@ID-132594.news.dfncis.de...
> on Tuesday 01 July 2003 07:18 pm, dj <thecommissioner@hotmail.com> wrote
> in <3f02410e$0$30568$afc38c87@news.optusnet.com.au>:
>
> > Hi,
> > I am writing a script that parses an html file (which has been retrieved
> > as
> > a scalar by LWP::UserAgent). The script looks for everything in between
> > the first <P> tag and the last </P> tag, with any number of <P> and </P>
> > tags in
> > between. I am sure I have done something like this before, but for the
> > life
> > of me I can't remember how... (maybe i did it before in lex). Anyone
> > got any neato suggestions?
>
> Are you looking for //s ? It makes '.' match newlines, too. I'd probably
> do it like this (the 'i' to ignore case, as some people capitalize all
> tags and some don't):
>
> /<p>(.*)<\/p>/si
>
>
> --
> Nicholas Knight <nknight@runawaynet.com>
------------------------------
Date: 02 Jul 2003 03:27:34 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: regular expression
Message-Id: <slrnbg4k98.1ge.mgjv@verbruggen.comdyn.com.au>
On 02 Jul 2003 03:02:47 GMT,
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> A _very_ simpleminded approach could do this:
>
> my ($stuff) = /<P>(.*)</P>/i;
Addition: You also need the /s flag to match newlines. But again, I
wouldn't use it.
Martien
--
|
Martien Verbruggen | If at first you don't succeed, try again.
Trading Post Australia | Then quit; there's no use being a damn fool
| about it.
------------------------------
Date: 1 Jul 2003 20:01:18 -0700
From: stuseven@hotmail.com (stu7)
Subject: Re: SHIFT not shuffling ?
Message-Id: <d7dd90b0.0307011901.23ad47ba@posting.google.com>
*** ah yes, thank you martien for clearing this problem up for
*** me... unfortunately, I am out of practice, and my use of
*** "while", and other loop functions is limited to simpler examples.
*** All of your suggestions look good, and are much appreciated.
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message news:<slrnbg1mcq.3er.mgjv@verbruggen.comdyn.com.au>...
> On 30 Jun 2003 10:56:29 -0700,
> stu7 <stuseven@hotmail.com> wrote:
> > + Perl's SHIFT function seems to say that it both
> > reads, and removes, the first element of whatever array
> > is being used with it... shift or unshift for the first
> > or last array element is a handy idea,
>
> You misunderstand. shift() removes the first element, and unshift()
> puts a new element at the beginning of an array. The functions pop()
> and push() do the same at the end of the array.
>
> > although I'm not
> > too sure why a separate function is needed for this...
> > ...thats not my problem though :)
>
> I'm not sure what you're saying here. Perl has many functions that are
> not strictly necessary. shift(), unshift(), pop() and push() can all
> be removed, which would mean everyone would just use splice().
> However, the four former functions make code just so much more
> readable than having splice() everywhere with the larger number of
> arguments.
>
> pop could be implemented with two reverse() calls and a shift(), but
> do you really want to code that way?
>
> Or are you asking why it should be possible to remove elements from an
> array from both ends? Many data structures need that sort of thing. A
> FIFO (first in, first out) queue can be implemented with an array and
> a combination of unshift/pop or push/shift for adding elements to the
> queue and removing them. Sure, it can be implemented in many other
> ways that don't require these functions, but having them makes the
> code easier to write, understand and maintain. And it prevents you
> from having to write them yourself all the time.
>
> Have you ever programmed in more "sparse" languages, like C?
>
> > I tried using shift to erase the first element of an
> > array repeatedly, until it was empty... nice for a counting
> > program maybe...
> >
> > $a = shift(@oneTOfive) ;
> > print $a ;
> >
> > ...here is where I got stuck... how do you print the first
> > shifted element, and then get to the next ? I actually tried
> > "next", which perl didnt accept.
>
> while (@oneTOfive)
> {
> my $element = shift @oneTOfive;
> print $element;
> }
>
> If you want to preserve the array:
>
> for my $element (@oneTOfive)
> {
> print $element;
> }
>
> Or shorter:
>
> print for @oneTOfive;
>
> > I then tried a GOTO loop... and I know this function has
> > many fans in the perl community :)... odd, with a goto, the
> > first element seemed to reprint, like it never got erased ?
> > Also, I tried my first big plate of perl spaghetti :)
>
> Why a goto when there are so many other loop constructions available?
> I wouldn't go as far as saying that goto has no place in any
> language, Perl specifically, I would say that its use should be
> limited as much as possible [1].
>
> > So finally... after copying the above two lines for each
> > element, I was able to erase every element in the array, but
> > isn't there a simple [next type of thing] to use with SHIFT...
> > or is it just one of those simple functions that were never
> > intended to do fancy work ?
>
> This really has little to do with shift(). It has to do with your
> apparent lack of knowledge of the normal looping constructs. Have a
> look at the perlsyn documentation for a thorough discussion of them.
> And while all those looping constructions can be rewritten using goto,
> I would simply not go there.
>
> Martien
>
> [1] I am only talking about goto LABEL and goto EXPR. goto &SUB is a
> different sort of beast, called by the same keyword.
------------------------------
Date: Wed, 2 Jul 2003 00:43:58 +0100
From: "Bix" <demonnews@NOSPAMPLEASEbix.cc>
Subject: Upgrading from 5.6.0 to 5.8.0 - module problem
Message-Id: <bdt6c0$ip3$1$8300dec7@news.demon.co.uk>
Hi all, new to the group, any help is much appreciated!
This is the first time I have touched perl but I have recently bought a new
server with RedHat and Ensim on, as i was upgrading mySql from 3 to 4, I
needed to recompile perl, so thought i might as well upgrade to 5.8.0, yet
once I have compiled and installed 5.8.0, all my old modules are no longer
installed. Do i have to manually re-install them all (mainly server config
file editors) or is there a way of building perl to upgrade the previous
version with modules intact?
Thanks a lot, really need some help on this!!!
Bix.
------------------------------
Date: Wed, 02 Jul 2003 01:17:58 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Upgrading from 5.6.0 to 5.8.0 - module problem
Message-Id: <vg4cm6mq3c0549@corp.supernews.com>
In article <bdt6c0$ip3$1$8300dec7@news.demon.co.uk>,
Bix <demonnews@NOSPAMPLEASEbix.cc> wrote:
: This is the first time I have touched perl but I have recently bought a new
: server with RedHat and Ensim on, as i was upgrading mySql from 3 to 4, I
: needed to recompile perl, so thought i might as well upgrade to 5.8.0, yet
: once I have compiled and installed 5.8.0, all my old modules are no longer
: installed. Do i have to manually re-install them all (mainly server config
: file editors) or is there a way of building perl to upgrade the previous
: version with modules intact?
Take a look at the documentation for the CPAN module. You'll want to
use the autobundle command to inventory your 5.6.0 modules and then
fire up CPAN.pm under perl5.8.0 and install your private bundle.
Search for "POPULATE AN INSTALLATION WITH LOTS OF MODULES" or visit
or visit the following (split) URL:
http://www.perldoc.com/perl5.8.0/
lib/CPAN.html#POPULATE-AN-INSTALLATION-WITH-LOTS-OF-MODULES
Hope this helps,
Greg
--
Sometimes nothing can be a pretty cool hand.
-- Cool Hand Luke
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
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.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 V10 Issue 5165
***************************************