[23129] in Perl-Users-Digest
Perl-Users Digest, Issue: 5350 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 12 21:07:24 2003
Date: Tue, 12 Aug 2003 18: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, 12 Aug 2003 Volume: 10 Number: 5350
Today's topics:
Re: "Undefined subroutine" error (but it's defined, I t <bwalton@rochester.rr.com>
Re: "web" vs. "traditional" development (was Re: Web de (MegaZone)
Re: Can't see http_referrer in IE <pkent77tea@yahoo.com.tea>
Extremely Basic mySQL question. <tylercruz@hotmail.com>
Re: Extremely Basic mySQL question. <tony_curtis32@yahoo.com>
Re: Extremely Basic mySQL question. <NOSPAM@bigpond.com>
Re: Extremely Basic mySQL question. <emschwar@pobox.com>
Re: Gnuplot module (David Combs)
Re: HTTP::Request failed on HTTP/1.1 and Connection: Ke (MegaZone)
Re: I need GD for Redhat 9 <simon.andrews@bbsrc.ac.uk>
Re: MLDBM (Jeff Mott)
Re: MLDBM <emschwar@pobox.com>
pack V length changes <sjackman@nospam.pathwayconnect.com>
Re: pack V length changes <bwalton@rochester.rr.com>
Re: Perl popup window under MS Windows <bwalton@rochester.rr.com>
Replacing identical lines in a RE <zebu@pingou.ath.cx>
Re: Replacing identical lines in a RE <nospam@please.com>
substitute three random words in a string <scripts you-know-the-drill hudsonscripting.com>
Re: substitute three random words in a string <bwalton@rochester.rr.com>
Re: To count a number of lines in C++ or Java or ASCII <bwalton@rochester.rr.com>
Re: Windows user --take 2 <michael.p.broida@boeing.com>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Aug 2003 22:26:17 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: "Undefined subroutine" error (but it's defined, I think?)
Message-Id: <3F39695E.4000500@rochester.rr.com>
Benjamin Goldberg wrote:
> valerian2@hotpop.com wrote:
> [snip]
>
>>package My::DB;
>>
>>use strict;
>>use Exporter;
>>use My::SOAP; # XXX this line causes the problem
>>use vars qw(@ISA @EXPORT);
>>@ISA = ('Exporter');
>>@EXPORT = qw(DB_Connect DB_Disconnect);
>>
> [snip function definitions]
>
>># SOAP functions, for exchanging data with remote site
>>package My::SOAP;
>>
>>use strict;
>>use Exporter;
>>use My::Misc; # XXX this line causes the problem
>>use vars qw(@ISA @EXPORT);
>>@ISA = ('Exporter');
>>@EXPORT = qw(GetRemoteData);
>>
> [snip function definition]
>
> Remember that 'use' happens at compile time, and @EXPORT= and @ISA=
> happen at run time.
>
> If you changed the beginnings of these three modules to:
>
> package My::DB;
> BEGIN {
> require Exporter;
> @ISA = qw(Exporter);
> @EXPORT = qw(DB_Connect DB_Disconnect);
> }
> use strict;
> use My::SOAP;
>
> And:
>
> package My::SOAP;
> BEGIN {
> require Exporter;
> @ISA = qw(Exporter);
> @EXPORT = qw(GetRemoteData);
> }
> use strict;
> use My::Misc
>
> And:
>
> package My::Misc;
> BEGIN {
> require Exporter;
> @ISA = qw(Exporter);
> @EXPORT = qw(SafeError);
> }
> use strict;
> use My::DB;
>
> Then it *should* work. [but since this code is untested, don't sue me
> if it doesn't.]
Hmmmmm...yes, that does make it work. But I don't think the explanation
is quite right. @EXPORT and @ISA *do* get defined at compile time,
because the use() is the same as BEGIN{require module;import module}.
The require() do'es the module code, including the assignments to
@EXPORT and @ISA, at compile time. And the import method runs at
compile time. The do() from the use() will run before the import, so
everything should be defined. BUT some of the modules are use'd twice,
and the second time the do() is not performed. In the package of the
second call to use(), @EXPORT and @ISA don't get defined, so the routine
doesn't know it is an Exporter, so Exporter's import doesn't get called.
And the @EXPORT list doesn't get exported. Your solution works
because @ISA and @EXPORT are defined in the package namespace before the
use() is called. I think that is right because I traced through it with
the debugger with BEGIN{$DB::single=1} to debug the stuff executed at
compile time.
Pretty hairy. My apologies for my incorrect first analysis, as pointed
out by Abigail and valerian2.
--
Bob Walton
------------------------------
Date: 12 Aug 2003 23:46:48 GMT
From: usenet@megazone.org (MegaZone)
Subject: Re: "web" vs. "traditional" development (was Re: Web development and Perl 6)
Message-Id: <megazone.1060732007@sidehack.sat.gweep.net>
Charlton Wilbur <cwilbur@mithril.chromatico.net> shaped the electrons to say:
>No, I claimed that it was good for *clueless* new web developers to
>turn to PHP. The "clueless" in that phrase is *critical*.
>
>A clueful new web developer will quickly learn enough to look at the
>tools available, and pay $5 a month more for access to mod_perl.
What's up with the PHP bashing anyway? If PHP does the job, then so
be it. Reading this thread you'd think PHP was the anti-Perl or
something.
I've been working with web technology since 1991 - back then that
pretty much meant HTML. :-) I've written dynamic services to provide
human readable HTML or data based seb services in Perl, PHP, and a
little JSP. I've done maintenance coding on ASP and ColdFusion as
well. I have some rather rusty C/C++ skills in there too. These days
I consider Perl my primary language, and I have for a while. I first
really started using it in 1994. But I'll use PHP for some tasks, and
I've actually wanted to get a lot deeper into PHP for a while. As
luck would have it my next big task at work is to write a PHP4 version
of the web services scripts we currently have in ASP, CF, and Perl.
PHP is a perfectly good tool, IMHO, and I don't think it is a toy
language as I've seen it called. Would I use it for system
administration scripts? No. But for a web based application, it can
do just as good a job as Perl - and it can do so with greater ease of
development. PHP is a specialized tool with a more limited scope,
Perl is an entire toolbox.
PHP continues to evolve, of course, I've been looking at the coming
PHP5 and Zend2, and there are some nice improvements.
Pick the right tool for the job. If you would really benefit from
mod_perl, then fine. But if PHP, or a straight perl CGI, will do the
job just as well (or perhaps almost as well, but cheaper, or with less
effort, etc - real world issues) then use what gives you the best ROI
overall.
I have a personal web project floating in limbo that I started
planning in Perl, but I'm seriously considering doing it in PHP
because I'd like to give it out if I ever finish it, and I think it'd
be useful to more 'average' users as PHP. We're doing the PHP port at
work because the current most requested platform is PHP (mostly
Linux/PHP, but some Windows/PHP). It looks like it may even displace
ASP, which has been the platform we saw the most with customers.
Pick the right tool for the job after considering all the issues -
that might be Perl, or PHP, or Python, or even Visual Basic. Each is
good for certain tasks.
-MZ, CISSP #3762, RHCE #806199299900541
--
<URL:mailto:megazone@megazone.org> Gweep, Discordian, Author, Engineer, me..
"A little nonsense now and then, is relished by the wisest men" 508-755-4098
<URL:http://www.megazone.org/> <URL:http://www.eyrie-productions.com/> Eris
------------------------------
Date: Wed, 13 Aug 2003 00:12:53 +0100
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Can't see http_referrer in IE
Message-Id: <pkent77tea-D45177.00125313082003@usenet.force9.net>
In article <vjhonqbbsarv03@corp.supernews.com>,
"Michael Hill" <hillmw@charter.net> wrote:
> I have a p[erl script that looks at the http_referrer for security purposes,
> but when using the IE browser i can't see the http_referrer from the pgm,
> i.e $env{http_referrer}. I can using mozilla.
> What's up with that. On some of my pgms I need to make sure they are being
> referrered by a url on my site
> and not executed standalone.
It probably depends on your web server software but on my Apache setup
the environment variable is called 'HTTP_REFERER'. Note the case and the
spellling.
Also, don't forget that the referrer can easily be faked if someone
particularly wanted to get one of your pages directly.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Wed, 13 Aug 2003 00:05:33 GMT
From: "Tyler Cruz" <tylercruz@hotmail.com>
Subject: Extremely Basic mySQL question.
Message-Id: <hhf_a.738405$Vi5.16855702@news1.calgary.shaw.ca>
Hi,
I was wondering how should I download the mySQL dump to my computer via FTP?
ASCII or binary? Or does it matter?
Thanks a lot,
Tyler
------------------------------
Date: Tue, 12 Aug 2003 19:11:11 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Extremely Basic mySQL question.
Message-Id: <87isp2ju1s.fsf@limey.hpcc.uh.edu>
>> On Wed, 13 Aug 2003 00:05:33 GMT,
>> "Tyler Cruz" <tylercruz@hotmail.com> said:
> Hi, I was wondering how should I download the mySQL dump
> to my computer via FTP? ASCII or binary?
> Or does it matter?
not to perl-related newsgroups, no.
hth
t
------------------------------
Date: Wed, 13 Aug 2003 10:11:18 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: Extremely Basic mySQL question.
Message-Id: <bhbvn0$104ubb$1@ID-202028.news.uni-berlin.de>
"Tyler Cruz" <tylercruz@hotmail.com> wrote in message
news:hhf_a.738405$Vi5.16855702@news1.calgary.shaw.ca...
> Hi,
>
> I was wondering how should I download the mySQL dump to my computer via
FTP?
> ASCII or binary? Or does it matter?
>
> Thanks a lot,
>
> Tyler
Try both! I use binay. The ascii option is there because of different line
termination characters in different operating systems.
gtoomey
------------------------------
Date: Tue, 12 Aug 2003 18:14:45 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Extremely Basic mySQL question.
Message-Id: <etosmo6o1l6.fsf@wormtongue.emschwar>
"Tyler Cruz" <tylercruz@hotmail.com> writes:
> I was wondering how should I download the mySQL dump to my computer via FTP?
> ASCII or binary? Or does it matter?
Okay, unlike the MLDBM question, this one actually has bugger-all to
do with Perl. But since some people somehow think clpm should be a
haven to answer all questions, no matter what they have to do with the
actual topic of the newsgroup, I'll be helpful anyway:
If I were you, I'd try one, and then if it didn't work, I'd try the
other. You know, if you had just tried, you probably would have
already found out by now, and wouldn't have had to wait. Trying isn't
fatal, you know.
> Thanks a lot,
Glad to help.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Wed, 13 Aug 2003 01:03:35 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: Gnuplot module
Message-Id: <bhc2p6$som$1@reader2.panix.com>
In article <87ispm1ma0.fsf@vran.herceg.de>,
Slaven Rezic <slaven@rezic.de> wrote:
>yuchung@mail.com (Yuchung Cheng) writes:
>
>> alythh@netscape.net (Alythh) wrote in message news:<6a25ba72.0307230050.57da7475@posting.google.com>...
>> > I just installed Chart::Graph::Gnuplot, and I'm fairly satisfied.
>> > But...
>> >
>> > My wish is to be able to make a gnuplot() call, make it display the
>> > graph, and stay there while other data becomes available... while
>> > replotting the updated data.
>> >
>> > Is there a way to communicate between the two processes in this way?
>> > Or is this module just to output to a file?
>> >
>> AFAIK, gnuplot only parse static data and generate the graph, even with
>> "gnuplot -persist" command. The simplist way to do above is to call
>> gnuplot every once while and re-plot to the same file.
>
>No, it's perfectly possible to open a communication channel via
>IO::Pipe and to send multiple commands to gnuplot. Example code on
>demand.
>
>Regards,
> Slaven
Demand.
Thanks!
David
------------------------------
Date: 13 Aug 2003 00:26:07 GMT
From: usenet@megazone.org (MegaZone)
Subject: Re: HTTP::Request failed on HTTP/1.1 and Connection: Keep-Alive
Message-Id: <megazone.1060734366@sidehack.sat.gweep.net>
simon.tneoh@mybiz.net (Simon Tneoh) shaped the electrons to say:
>to simulate the headers in the IE's request in HTTP::Request, but I failed to
>make it work. I just wonder if it's because HTTP::Request doesn't support
>HTTP/1.1 and Keep-Alive properly?
I'd probably throw a sniffer at it (like Etherial) - grab the headers
from the successful IE connect, and the unsuccessful Perl connect, and
see what differs - then see what I might be able to do to make the
Perl options resemble the IE configuration.
Presuming the Java were a black box. (Been there, done that -
sometimes you *can't* 'fix' the other bit, you just to make your bit
work with it as is.)
But if you do have the ability to tweak the Java, add some better
error handling to at least trap what is going wrong.
-MZ, CISSP #3762, RHCE #806199299900541
--
<URL:mailto:megazone@megazone.org> Gweep, Discordian, Author, Engineer, me..
"A little nonsense now and then, is relished by the wisest men" 508-755-4098
<URL:http://www.megazone.org/> <URL:http://www.eyrie-productions.com/> Eris
------------------------------
Date: Thu, 07 Aug 2003 12:56:50 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: I need GD for Redhat 9
Message-Id: <3F323E82.6050108@bbsrc.ac.uk>
Jim Rendant wrote:
> I downloaded the GD module from CPAN and tried to compile it on redhat 9 and
> it fails. Where can I get a pre-compiled version of this module?
Don't know about RH9, but I've just managed to get GD installed on RH8,
and it was a right pain! The latest perl GD module won't work because
the gd-lib version on RH8 (and I think 9) is too old. I managed to
install the new gd-lib OK, but couldn't get make to complete on perl-GD
even when linking to the new version. Others seem to have had the same
problems previously and the answer was "recompile perl" - which I
didn't fancy. I too went looking for a pre-done RPM, but with no luck.
My solution was to pull down a slightly older version of GD direct from
Lincoln Stein's homepage. I used GD1.43.
http://stein.cshl.org/WWW/software/GD/old/
You need to install a bunch
of devel RPMS to get all the headers you need. Off the top of my head
you need:
XFree86-devel
libpng-devel
libjpeg-devel
freetype-devel
All these were on the stock RH distribution. Once these were installed
then the make for perl-GD 1.43 completed OK.
Hope this helps
Simon.
------------------------------
Date: 12 Aug 2003 16:54:07 -0700
From: mjeff1@twcny.rr.com (Jeff Mott)
Subject: Re: MLDBM
Message-Id: <970676ed.0308121554.35e70857@posting.google.com>
simonis <simonis@myself.com> wrote in message news:<3F390EF7.63A954C5@myself.com>...
> Jeff Mott wrote:
> >
> > Is there a wrapper to perform encryption on an MLDBM database? Since
> > file permissions is a Unix-only feature, I'd prefer not to rely on
> > that. Data encryption would appear to be the only cross platform way
> > to keep the data secure. Unless someone has any better ideas...?
>
> Not sure how this is related to Perl.
errr....why are so many people so !@#$ %^&* about this kind of
thing?!?
There is an MLDBM module __FOR PERL__. I am importing this module into
my program, written __IN PERL__. I want this data secure without being
dependant on any particular OS. So I need a sub class of MLDBM (that
would be another __PERL MODULE__) that, using an encryption
implemention __WRITTEN FOR PERL__, encrypts/decrypts all data
stored/retrieved.
Are you seeing how this relates to Perl yet?
------------------------------
Date: Tue, 12 Aug 2003 18:04:34 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: MLDBM
Message-Id: <etowudio225.fsf@wormtongue.emschwar>
mjeff1@twcny.rr.com (Jeff Mott) writes:
> errr....why are so many people so !@#$ %^&* about this kind of
> thing?!?
Because a lot of people post questions like, "When I print this
javascript code to the browser with perl, it doesn't work. How should
I fix it?" Not to say your question is in that league, but after a
few thousand time, it does get old.
> There is an MLDBM module __FOR PERL__. I am importing this module into
> my program, written __IN PERL__. I want this data secure without being
> dependant on any particular OS. So I need a sub class of MLDBM (that
> would be another __PERL MODULE__) that, using an encryption
> implemention __WRITTEN FOR PERL__, encrypts/decrypts all data
> stored/retrieved.
So, you can't rely on OS permissions to prevent people from reading
the MLDBM file, but you can rely on them to prevent people from
reading the encryption/decryption key in your script? That makes no
sense to me, unless your program and MLDBM file are on different
OSes.
Seems to me you could use something like GnuPG::Interface or Crypt::*
to encrypt/decrypt the file, but you still get back to the question of
how your program can decrypt the file without letting anyone else see
the contents, and the only way I know of to do that is via OS
permissions.
Semi-on-topic: Doesn't NTFS have ACLs or some such that you could use
to the same effect as OS permissions? AFAIK, most other semi-modern
OSes have some sort equivalent to the Unix permissions model.
> Are you seeing how this relates to Perl yet?
Your question seemed reasonable to me, and I'm semi-hair-trigger about
these things myself.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Tue, 12 Aug 2003 22:12:18 GMT
From: Shaun Jackman <sjackman@nospam.pathwayconnect.com>
Subject: pack V length changes
Message-Id: <6Dd_a.70646$JT2.1666447@news2.telusplanet.net>
Running the following little bit
$header = pack "V12 v6 V6 v8", @fields;
print length $header;
prints
100
However, the following
$header = pack "V12 v6 V6 v8", @fields;
print $header;
then (where foo is the above script)
./foo | wc -c
prints
107
Where did the extra 7 characters come from? I'm very confused. Why does the
length of the $header report 100, but 107 characters get printed? Do I have
to set STDOUT to a binary stream somehow?
Please cc me in your reply,
Thanks,
Shaun
------------------------------
Date: Tue, 12 Aug 2003 22:36:09 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: pack V length changes
Message-Id: <3F396BAE.6020102@rochester.rr.com>
Shaun Jackman wrote:
> Running the following little bit
> $header = pack "V12 v6 V6 v8", @fields;
> print length $header;
> prints
> 100
>
> However, the following
> $header = pack "V12 v6 V6 v8", @fields;
> print $header;
> then (where foo is the above script)
> ./foo | wc -c
> prints
> 107
>
> Where did the extra 7 characters come from? I'm very confused. Why does the
> length of the $header report 100, but 107 characters get printed? Do I have
> to set STDOUT to a binary stream somehow?
Yes.
perldoc -f binmode
...
> Shaun
--
Bob Walton
------------------------------
Date: Tue, 12 Aug 2003 22:52:23 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl popup window under MS Windows
Message-Id: <3F396F7B.4070707@rochester.rr.com>
John Navas wrote:
> A simple and crude but often effective alternative to Win32::MsgBox is:
>
> system("%COMSPEC% /c echo YOUR MESSAGE\a & pause");
>
> This will open a command window, display the line of YOUR MESSAGE (with the \a
> causing a beep), and then pause with "Press any key to continue..."),
> whereupon your Perl program will continue.
Doesn't seem to work on Windoze 98SE with AS Perl build 806. The echo
occurs in the command window and there is no "Press any key to continue...".
And, I can't find my "any" key:-).
--
Bob Walton
------------------------------
Date: Wed, 13 Aug 2003 02:18:53 +0200
From: Francois Wisard <zebu@pingou.ath.cx>
Subject: Replacing identical lines in a RE
Message-Id: <slrnbjj0vd.4sq.zebu@pingou.ath.cx>
Hi,
I have a problem with a one-liner.
I have this data:
%
I WAS NOT TOUCHED "THERE" BY AN ANGEL
I WAS NOT TOUCHED "THERE" BY AN ANGEL
I WAS NOT TOUCHED "THERE" BY AN ANGEL
I WAS NOT TOUCHED "THERE" BY AN ANGEL
Bart Simpson on chalkboard in episode BABF14
%
I AM NOT HERE ON A FARTBALL SCHOLARSHIP
I AM NOT HERE ON A FARTBALL SCHOLARSHIP
I AM NOT HERE ON A FARTBALL SCHOLARSHIP
I AM NOT HERE ON A FARTBALL SCHOLARSHIP
etc..
and I want this output:
%
I WAS NOT TOUCHED "THERE" BY AN ANGEL
I WAS NOT TOUCHED "THERE" BY AN ANGEL
I WAS NOT TOUCHED "THERE" BY AN ANGEL
Bart Simpson on chalkboard in episode BABF14
%
I AM NOT HERE ON A FARTBALL SCHOLARSHIP
I AM NOT HERE ON A FARTBALL SCHOLARSHIP
I AM NOT HERE ON A FARTBALL SCHOLARSHIP
etc.
I thought perl -pe 's/^\n$//;s/(.+){4}/$1$1$1/sm'
/usr/share/games/fortune/chalkboard
would do the trick, but no...
What am I missing?
Francois
--
If you think sex is a pain in the ass, try a different position.
------------------------------
Date: Wed, 13 Aug 2003 00:56:20 GMT
From: Gunter Schelfhout <nospam@please.com>
Subject: Re: Replacing identical lines in a RE
Message-Id: <U0g_a.64067$F92.7241@afrodite.telenet-ops.be>
Francois Wisard wrote:
[knip]
>
> I thought perl -pe 's/^\n$//;s/(.+){4}/$1$1$1/sm'
> /usr/share/games/fortune/chalkboard
> would do the trick, but no...
It may be ugly, but is seems to work:
perl -p00e 's/%\n.+/%/g; s/\n$//' <file>
--
Blood, sweat & tears
------------------------------
Date: Tue, 12 Aug 2003 18:50:57 -0700
From: Hudson <scripts you-know-the-drill hudsonscripting.com>
Subject: substitute three random words in a string
Message-Id: <ub6jjvcbpr4to5rd3e1kmqgcdr0nm5r5sp@4ax.com>
Hi, can anyone give me a little clue here. Say I have an html file
that has code in it like this:
<center><b>_one_ _two_ _three_</b><center>
Now, I know how to replace this using reg expressions
$_ =~ s/_one_/one/g;
etc...but, I want to run each replacement through a subroutine that
randomizise an array and then do the replacement. So right now I can
do something like:
if ($_ =~ /_one_/) { randomize_one () }
sub randomize_one {
...randomize routine...
print "$array[0]";
}
but...as you can see...each line is "lost" so I need the replacement
codes on separate lines:
<center><b>
_one_
_two_
_three_
</b><center>
I'm having a devil of the time here, so any help would be appreciated!
------------------------------
Date: Wed, 13 Aug 2003 00:00:03 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: substitute three random words in a string
Message-Id: <3F397F56.2030104@rochester.rr.com>
Hudson wrote:
> Hi, can anyone give me a little clue here. Say I have an html file
> that has code in it like this:
>
> <center><b>_one_ _two_ _three_</b><center>
>
> Now, I know how to replace this using reg expressions
>
> $_ =~ s/_one_/one/g;
>
> etc...but, I want to run each replacement through a subroutine that
> randomizise an array and then do the replacement. So right now I can
> do something like:
>
> if ($_ =~ /_one_/) { randomize_one () }
>
> sub randomize_one {
> ...randomize routine...
> print "$array[0]";
> }
>
> but...as you can see...each line is "lost" so I need the replacement
> codes on separate lines:
>
> <center><b>
> _one_
> _two_
> _three_
> </b><center>
>
> I'm having a devil of the time here, so any help would be appreciated!
>
Try:
$_ =~ s/_one_/randomize_one()/eg;
or:
$_ =~ s/_(\w+)_/randomize_them_all($1)/eg;
The key is the "e" switch. Read all about it in:
perldoc perlop
under "Regexp Quote-Like Operators".
--
Bob Walton
------------------------------
Date: Tue, 12 Aug 2003 22:44:39 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: To count a number of lines in C++ or Java or ASCII files by exluding white spaces and comments
Message-Id: <3F396DAC.2000500@rochester.rr.com>
John Smith wrote:
...
> We have huge files in Java and C++ and I need to count the total
> number of lines in each of them by excluding white spaces (from the
> beginning of a line) and comments (C++, Java comments etc).
>
> There must be some scripts in perl to do this job.
>
> Can anyone kindly let me know? Or, are there any third-party tools to
> do this job?
...
> John
>
Most of this is a FAQ, at least for the C++ part:
perldoc -q comment
Maybe that'll be good enough for Java too?
Removing blank lines can be done with
next if /^\s*$/;
assuming you are reading and processing your lines in a loop.
--
Bob Walton
------------------------------
Date: Tue, 12 Aug 2003 22:09:06 GMT
From: "Michael P. Broida" <michael.p.broida@boeing.com>
Subject: Re: Windows user --take 2
Message-Id: <3F396582.FA149663@boeing.com>
Mothra wrote:
>
> > C:\1\DOWNLO~1\perl\modules\SEARCH~1.95>nmake
> >
> > Microsoft (R) Program Maintenance Utility Version 1.50
> > Copyright (c) Microsoft Corp 1988-94. All rights reserved.
> >
> > NMAKE : fatal error U1081: 'C:\WINNT\system32\cmd.exe /e:2048' : program
> > not found
> > Stop.
> It seems that you do not have cmd.exe. This is standard on
> WNT4.0 W2K and XP however I am not sure about the
> other windows OS's. Have you checked to see if you have this
> exe file?
Try "command" instead of "cmd". On some versions
of Windows (W9x?), "command" is the command prompt.
Mike
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5350
***************************************