[22192] in Perl-Users-Digest
Perl-Users Digest, Issue: 4413 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 16 09:05:41 2003
Date: Thu, 16 Jan 2003 06:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 16 Jan 2003 Volume: 10 Number: 4413
Today's topics:
Re: $x =~ s!(\d+)%!$1/100!e; <fb@geo-guide.com>
Re: Can anyone answer this? (Anno Siegel)
Convert HTML to TEXT (Dimitri)
Re: Convert HTML to TEXT <bernard.el-hagin@DODGE_THISlido-tech.net>
filehandle -- checking if there's anything left <mzawadzk@man.poznan.pl>
Re: filehandle -- checking if there's anything left <tassilo.parseval@post.rwth-aachen.de>
Re: filehandle -- checking if there's anything left <krahnj@acm.org>
Re: find2perl on windows doesn't work correctly <bart.lateur@pandora.be>
Re: find2perl on windows doesn't work correctly (Helgi Briem)
Re: Forced switch from PERL to ASP/VBSCRIPT. Where do I (Phil Preen)
Re: Forced switch from PERL to ASP/VBSCRIPT. Where do I <raffles2@att.net>
how to Install tar ball perl 5.8 to replace 5.6.1 in Re <oooooops@163.com>
Re: how to Install tar ball perl 5.8 to replace 5.6.1 i <tassilo.parseval@post.rwth-aachen.de>
Re: HTML::Table conflict? <postmaster@127.0.0.1>
Is logic in regular expression possible? (Michael J.)
Re: Is logic in regular expression possible? <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: Is logic in regular expression possible? <abigail@abigail.nl>
Re: Is logic in regular expression possible? (Anno Siegel)
Re: Outputting a binary file to the browser <tassilo.parseval@post.rwth-aachen.de>
Re: Outputting a binary file to the browser (Tony L. Svanstrom)
Re: perl and the genome project <bigiain@mightymedia.com.au>
perl cgi redirect to variables instead of displaying HT (Entfred)
Re: Problem with DBI (Jason Singleton)
Re: Renaming files *.txt to 1234.txt <me@privacy.net>
Re: Renaming files *.txt to 1234.txt <me@privacy.net>
Re: Renaming files *.txt to 1234.txt <josef.moellers@fujitsu-siemens.com>
Re: save and run bytocode <ubl@schaffhausen.de>
Storable.pm <spikey-wan@bigfoot.com>
Re: use constant? <ubl@schaffhausen.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 16 Jan 2003 10:57:42 +0100
From: "Frode Bjerkholt" <fb@geo-guide.com>
Subject: Re: $x =~ s!(\d+)%!$1/100!e;
Message-Id: <ijvV9.14146$Rc7.225498@news2.e.nsc.no>
Hi
Is this an atempt to URL-decode?
Then try something like this:
$x =~ s/\%([a-fA-F0-9]{2})/chr(hex($1))/eg;
..Or perhaps your expression is right, but you forgot to include the 'g' at
the end?
$x =~ s!(\d+)%!$1/100!eg;
Regards,
Frode
"istink" <istink@real.bad.com> wrote in message
news:3E2653FA.DA68DAF@real.bad.com...
> $x =~ s!(\d+)%!$1/100!e;
>
> I'm trying to convert a string of characters into ASCII.
> and then, change ASCII into convert.
>
>
> -----------== Posted via Newsfeed.Com - Uncensored Usenet News
==----------
> http://www.newsfeed.com The #1 Newsgroup Service in the World!
> -----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers
=-----
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 10.01.03
------------------------------
Date: 16 Jan 2003 10:41:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Can anyone answer this?
Message-Id: <b0629c$ng4$1@mamenchi.zrz.TU-Berlin.DE>
Paulo <threepio23@yahoo.com> wrote in comp.lang.perl.misc:
> What strings parse according to:
>
> $phone =~ /^
> (?:1-?)? # optional 1 or 1-
> (?: # start alternate
> \(
> (\d{3}) # case of number enclosed in parentheses
> \)
> |
> (\d{3}) # case of bare number
> ) # end alternate
> -? # optional -
> (\d{3})
> -?
> (\d{4})
> $/x;
>
> print "Parts are\n";
> print "$1\n";
> print "$2\n";
> print "$3\n";
> print "$4\n";
Looks like a homework assignment.
Anno
------------------------------
Date: 16 Jan 2003 02:18:50 -0800
From: mauroid@csi.forth.gr (Dimitri)
Subject: Convert HTML to TEXT
Message-Id: <a3ebf7b8.0301160218.6ac21c8f@posting.google.com>
Hello,
Is there some Perl module (or any other way), that will convert HTML to
text?
This is the problem I am trying to solve: There is a big collection of
HTML pages that look like a dictionary: There is a word in bold, which
is preceded by a bookmark with the same name as the word, followed by
an explanation of the word in HTML. I need to write a script that parses
these html files, looks for a given bookmark, and displays the word with
the explanation in plain text.
E.g. the following exists in one t\of the files :
<a href="#cat"><b>bat</b>
<P>A pet with <u>four</u> legs commonly scratching your furniture</P>
The user would call :
% whatis cat
And he would see printed in the terminal, after the 'whatis' script parses
all html files and finds the entry for cat :
cat: A pet with four legs commonly scratching your furniture.
So, obviously I need to be able to transform HTML to text to do this.
Thanks for any help,
Dimitri
------------------------------
Date: Thu, 16 Jan 2003 10:19:59 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Convert HTML to TEXT
Message-Id: <b0610f$cnc$1@korweta.task.gda.pl>
In article <a3ebf7b8.0301160218.6ac21c8f@posting.google.com>, Dimitri
wrote:
> Hello,
>
> Is there some Perl module (or any other way), that will convert HTML to
> text?
Yes. Search here:
http://search.cpan.org/
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Thu, 16 Jan 2003 10:04:22 +0100
From: Marek Zawadzki <mzawadzk@man.poznan.pl>
Subject: filehandle -- checking if there's anything left
Message-Id: <Pine.GSO.4.44.0301161001430.7594-100000@rose.man.poznan.pl>
Mornin'
Is there an elegant and portable way of telling whether there is anything
left to read from a filehandle (including pipes) without actually reading
from it and checking if read returns 0?
-marek
------------------------------
Date: 16 Jan 2003 09:48:18 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: filehandle -- checking if there's anything left
Message-Id: <b05v52$e1n$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Marek Zawadzki:
> Is there an elegant and portable way of telling whether there is anything
> left to read from a filehandle (including pipes) without actually reading
> from it and checking if read returns 0?
Sounds like a job for eof():
if (! eof HANDLE) {
print "There is still something to read from HANDLE";
}
But check 'perldoc -f eof'. It mentions some things that might be
important for your case.
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
Date: Thu, 16 Jan 2003 09:52:04 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: filehandle -- checking if there's anything left
Message-Id: <3E268014.2BC1169F@acm.org>
Marek Zawadzki wrote:
>
> Is there an elegant and portable way of telling whether there is anything
> left to read from a filehandle (including pipes) without actually reading
> from it and checking if read returns 0?
perldoc -f eof
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 16 Jan 2003 10:06:55 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: find2perl on windows doesn't work correctly
Message-Id: <2l0d2v4sm38e8uarhnvceqmn8co9ea5hff@4ax.com>
Yang Xiao wrote:
>The actual dir command is being mangled as
>dirc:\/WINNT/ShellIconCache\
And now once more with spaces?
It looks to me like the combination of "/" and "\" characters is
throwing the system off. My guess is that it should all be backslashes.
That "c:\/" is strange too... I guess File::Find is to blame.
OK, try this. First, call find() with "c:/" as a parameter, not "c:\\".
And in $name, the forward slashes should be replaced with backslashes.
For example, somewhere at the top op doexec(), insert
(my $name) = $name =~ tr[/][\\];
(once). That makes a local lexical copy of the global $name, and
modifies the copy.
I think "dir" should be a bit happier now.
--
Bart.
------------------------------
Date: Thu, 16 Jan 2003 10:34:19 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: find2perl on windows doesn't work correctly
Message-Id: <3e268a22.1063775688@news.cis.dfn.de>
On Thu, 16 Jan 2003 00:15:53 -0500, "Yang Xiao"
<yxiao@panix.com> wrote:
>Hi all,
>I'm trying to use find2perl to do the following
>find2perl c:\ -size +10000 -exec dir {} \; >find.pl
Don't use backslashes, even under Windows,
there is no need. Why use dir? Why use
stat to get the file size? -s gets it directly.
Here is one way:
use warnings;
use strict;
use File::Find;
my $dir = 'C:/';
my $min = 10000;
my %size;
find sub
{return if -d; $size{$File::Find::name} = -s; },$dir;
for (keys %size)
{
if ($size{$_}>$min) {print "$_\t$size{$_}\n" };
}
__END__
--
Regards, Helgi Briem
helgi AT decode DOT is
------------------------------
Date: Thu, 16 Jan 2003 05:00:02 CST
From: phil@triton-technology.co.uk (Phil Preen)
Subject: Re: Forced switch from PERL to ASP/VBSCRIPT. Where do I begin?
Message-Id: <e12d0736.0301160234.505425f8@posting.google.com>
Dan <dharding@uiuc.edu> wrote in message news:<81iV9.12677$Vf3.133412@vixen.cso.uiuc.edu>...
> Due to a merger of university departments, I am potentially being forced
> to change the way I do web development. I've always used PERL for my CGI
> development. I'm now being told by the new derpartment head that "he
> doesn't want PERL running on any of his servers; it's too CPU-intensive"
He is an idiot.
> so I must now do all coding in VBScript/ASP.
It is likely to be the ASP that takes more learning than the VBScript.
The structure of an ASP file is very different to a PERL/CGI program.
If you have used PHP this is very similar to ASP.
You may (or may not) find Javascript slightly easier to learn than
VBScript, especially if you have had any exposure to C, C++ or Java.
If you have been doing web development you have probably already been
exposed to Javascript, so this will give you a head start.
Having said that, you should be able to pick up BASIC syntax easily
enough. The most difficult bit will be remembering to leave off the
semi-colons at the end of lines :-)
> Where do I start? (other than finding a new job).
If you don't want to have to learn new languages or if you don't want
to work for an idiot, finding a new job might be your best approach.
If your new boss requires you to learn ASP and for you to program in
VBScript instead of Perl, he will obviously have to send you on a
training course. Sounds like an oportunity for a jolly to me :-)
> Are there any "VB for PERL Afficionados" types
> of books or resources? What do you recommend for language references
> (downloadable/printable preferred)? How about "teach yourself" books?
> Assume I've never had any exposure to Visual Basic.
Be careful Visual Basic is not quite the same thing as VBScript.
Although, they are very, very similar. The language syntax is the
same, but typical applications are very different. Most of the books
on VB will concentrate mainly on GUI development (forms and controls)
which you won't be using. Look for a book on ASP instead.
> Not only do I have to learn the language(s)/techniques, but I then have
> to recode all existing applications. Yay.
This doesn't sound like much fun. How much existing code do you have?
Consider writing yourself a PERL to VBScript conversion utility. This
will be a much more interesting project :-)
I believe there are Perl compilers available. It might be worth
investigating this. If you turn your scripts into executables, you
won't need to have Perl running on the server, and this may keep your
boss happy.
Have fun, and don't panic!!
Phil.
--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.
HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html
------------------------------
Date: Thu, 16 Jan 2003 07:27:22 CST
From: "Ron Ruble" <raffles2@att.net>
Subject: Re: Forced switch from PERL to ASP/VBSCRIPT. Where do I begin?
Message-Id: <OumV9.43626$p_6.3752247@bgtnsc04-news.ops.worldnet.att.net>
"Dan" <dharding@uiuc.edu> wrote in message news:81iV9.12677$Vf3.133412@vixen.cso.uiuc.edu...
> Due to a merger of university departments, I am potentially being forced
> to change the way I do web development. I've always used PERL for my CGI
> development. I'm now being told by the new derpartment head that "he
> doesn't want PERL running on any of his servers; it's too CPU-intensive"
<snip>
In addition to the replies you've already received, if for
any reason you are still forced to use VBScript, there
are a few bright sides:
VBScript uses a Regular Expression Object that uses
Perl-style regular expressions.
ActiveState's Perl documentation has a section on ASP,
that should help you get up to speed quicker, and you
will be able to follow the examples easier, without dealing
with mentally parsing VBScript.
VBScript is pretty easy to learn. Do a search on Google.
There are tons of links.
http://www.devguru.com/Technologies/vbscript/quickref/vbscript_intro.html
http://www.maitreg.com/ASP/docs/vbsdocs/VBSTUTOR.HTM
http://www.asp-examples.com/objects/VBScript/vbstutor.htm
http://www.devasp.com/search/res/r17479.html
--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.
HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html
------------------------------
Date: Thu, 16 Jan 2003 16:36:23 +0800
From: "oooooops" <oooooops@163.com>
Subject: how to Install tar ball perl 5.8 to replace 5.6.1 in Redhat ??
Message-Id: <b05qud$gvl$1@mail.cn99.com>
I have three machines with Redhat 7.2~8.0
but now I want to update perl 5.6.1,default of Redhat,
to perl5.8 tarball package.
now if I rpm -e perl, there are many warnning and error:
error: removing these packages would break dependencies:
perl >= 5.6.0 is needed by perl-DateManip-5.39-5
perl >= 5.6.0-16 is needed by perl-Digest-MD5-2.13-1
perl >= 5.6.0 is needed by perl-HTML-Tagset-3.03-3
perl >= 5.6.0 is needed by perl-HTML-Parser-3.25-2
perl >= 5.6.0 is needed by perl-libnet-1.0703-6
perl >= 5.6.0 is needed by perl-MIME-Base64-2.12-6
perl >= 5.6.0 is needed by perl-Parse-Yapp-1.04-3
perl >= 5.6.0 is needed by perl-Storable-0.6.11-6
perl >= 5.6.0 is needed by perl-URI-1.12-5
perl >= 5.6.0 is needed by perl-libwww-perl-5.53-3
perl >= 5.6.0 is needed by perl-XML-Encoding-1.01-2
perl >= 5.6.0 is needed by perl-XML-Grove-0.46alpha-3
perl >= 5.6.0 is needed by perl-XML-Parser-2.30-7
perl >= 5.6.0 is needed by perl-libxml-perl-0.07-5
perl >= 5.6.0 is needed by perl-libxml-enno-1.02-5
perl >= 5.6.0 is needed by perl-XML-Dumper-0.4-5
perl >= 5.6.0 is needed by perl-XML-Twig-2.02-2
perl >= 5 is needed by perl-SGMLSpm-1.03ii-4
perl is needed by autoconf-2.13-14
perl is needed by automake-1.4p5-2
perl is needed by libtool-1.4-8
perl >= 1:5.6.1-26.72.3 is needed by perl-NDBM_File-1.75-26.72.3
perl >= 1:5.6.1-26.72.3 is needed by perl-DB_File-1.75-26.72.3
perl >= 1:5.6.1-26.72.3 is needed by perl-CPAN-1.59_54-26.72.3
perl >= 1:5.6.1-26.72.3 is needed by perl-CGI-2.752-26.72.3
perl = 5.6.1 is needed by mod_perl-1.26-2
perl is needed by mod_perl-1.26-2
perl >= 5.004 is needed by kdevelop-2.0.2-2
perl is needed by foomatic-1.1-0.20011218.3
perl is needed by logwatch-2.6-1
perl is needed by printconf-0.3.61-4.1
perl is needed by mozilla-1.0.1-2.7.2
perl is needed by php-4.1.2-7.2.6
perl is needed by php-imap-4.1.2-7.2.6
perl is needed by php-ldap-4.1.2-7.2.6
perl is needed by php-mysql-4.1.2-7.2.6
/usr/bin/perl is needed by cdlabelgen-1.5.0-9
/usr/bin/perl is needed by perl-libwww-perl-5.53-3
/usr/bin/perl is needed by lm_sensors-2.5.5-6
/usr/bin/perl is needed by ntp-4.1.0-4
/usr/bin/perl is needed by licq-1.0.3-7
/usr/bin/perl is needed by psutils-1.17-13
/usr/bin/perl is needed by a2ps-4.13b-15
/usr/bin/perl is needed by docbook-style-dsssl-1.64-3
/usr/bin/perl is needed by perl-SGMLSpm-1.03ii-4
/usr/bin/perl is needed by sgml-tools-1.0.9-12
/usr/bin/perl is needed by pilot-link-0.9.5-8
/usr/bin/perl is needed by netpbm-progs-9.14-2
/usr/bin/perl is needed by isdn4k-utils-3.1-46
/usr/bin/perl is needed by autoconf-2.13-14
/usr/bin/perl is needed by automake-1.4p5-2
/usr/bin/perl is needed by ncurses-devel-5.2-12
/usr/bin/perl is needed by procinfo-18-2
/usr/bin/perl is needed by qt-devel-2.3.1-5
/usr/bin/perl is needed by wu-ftpd-2.6.1-20
/usr/bin/perl is needed by groff-perl-1.17.2-7.0.2
/usr/bin/perl is needed by kdepim-2.2.2-3
/usr/bin/perl is needed by kdoc-2.2.2-1
/usr/bin/perl is needed by cvs-1.11.1p1-7
/usr/bin/perl is needed by kdemultimedia-2.2.2-2
/usr/bin/perl is needed by kdesdk-2.2.2-1
/usr/bin/perl is needed by kdevelop-2.0.2-2
/usr/bin/perl is needed by koffice-1.1.1-2
/usr/bin/perl is needed by foomatic-1.1-0.20011218.3
/usr/bin/perl is needed by rpm-build-4.0.4-7x
/usr/bin/perl is needed by vnc-server-3.3.3r2-18.4
/usr/bin/perl is needed by logwatch-2.6-1
/usr/bin/perl is needed by docbook-utils-0.6.9-2.1
/usr/bin/perl is needed by sharutils-4.2.1-8.7.x
/usr/bin/perl is needed by ghostscript-6.51-16.2
/usr/bin/perl is needed by printconf-0.3.61-4.1
/usr/bin/perl is needed by ucd-snmp-4.2.5-7.72.0
/usr/bin/perl is needed by ucd-snmp-utils-4.2.5-7.72.0
/usr/bin/perl is needed by squid-2.4.STABLE6-6.7.3
/usr/bin/perl is needed by lynx-2.8.4-17
/usr/bin/perl is needed by mozilla-1.0.1-2.7.2
/usr/bin/perl is needed by kdelibs-2.2.2-3
/usr/bin/perl is needed by kdenetwork-2.2.2-2
/usr/bin/perl is needed by apache-1.3.27-1.7.2
/usr/bin/perl is needed by apache-devel-1.3.27-1.7.2
/usr/bin/perl is needed by mysql-3.23.54a-3.72
how can I do with it??
and I just want to update with tarball but rpm pacakage.
Thanks for your kind.
JEJE
------------------------------
Date: 16 Jan 2003 08:59:51 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: how to Install tar ball perl 5.8 to replace 5.6.1 in Redhat ??
Message-Id: <b05sa7$bbe$1@nets3.rz.RWTH-Aachen.DE>
Also sprach oooooops:
> I have three machines with Redhat 7.2~8.0
> but now I want to update perl 5.6.1,default of Redhat,
> to perl5.8 tarball package.
>
> now if I rpm -e perl, there are many warnning and error:
>
> error: removing these packages would break dependencies:
> perl >= 5.6.0 is needed by perl-DateManip-5.39-5
> perl >= 5.6.0-16 is needed by perl-Digest-MD5-2.13-1
[...]
> how can I do with it??
> and I just want to update with tarball but rpm pacakage.
If you want to install it by compiling perl yourself, simply do so
without removing the old perl from your machine. You can have as many
Perl distributions living happily next to each other on the same computer.
Grab the tarball, extract and read INSTALL. The install script will
later ask you where it should put this perl. I have both Perl5.8.0 and
5.5.3 somewhere under /usr/opt. After that put some symlinks into the path
(something like /usr/bin/perl580 and /usr/bin/perldoc580) that point to
the real path.
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
Date: Thu, 16 Jan 2003 12:39:15 +0000
From: Anthony Peacock <postmaster@127.0.0.1>
Subject: Re: HTML::Table conflict?
Message-Id: <3E26A7F3.EAB76C@127.0.0.1>
"Jürgen Exner" wrote:
>
> noone@anon.com wrote:
> [...]
> > If I
> > run the script from the command line it produces the same (valid)
> > HTML output in either case.
>
> Then in all likelyhood you don't have a Perl problem.
>
> > I've run other scripts using only HTML::Table and they work fine.
> >
> > Anyone have any idea what's going on? Thanks.
>
> What does the error log of your CGI server say?
> I wonder if HTML:Table is installed....
>
> jue
Jurgen's advise is spot on. The first thing to look at is the server
log file for error messages. Next, when you say 'it doesn't render' do
you mean you get a blank browser window or do you get an error message?
If the window is blank, look at the page source, this will often give
you a clue as to which bit of the HTML document the browser barfed at.
But I suspect that Jurgen has hit the nail on the head in that I think
that your script is not able to 'find' the module when run as a CGI
program. This could be that you are testing from the command line on a
different machine, or the user/group that the CGI script runs as is
different to the one you use for testing at the command line and that
user does not have read/execute privileges to the module.
Either way the error log is your friend.
If you manage to narrow this down, please post back your findings, in
case there is a dependency in HTML::Table that I can fix.
------------------------------
Date: 16 Jan 2003 03:38:18 -0800
From: upro@gmx.net (Michael J.)
Subject: Is logic in regular expression possible?
Message-Id: <bc3e2bd9.0301160338.1c8fb98b@posting.google.com>
Hi all!
I wonder if the following is possible:
I havea word, let's say "hello", and I want to write a regex that
replaces vowel in the following manner:
a -> e
e -> a
i -> ai
o -> u
u -> o
... and I'd like to do it in one line, like this:
s/a,e,i,o,u/e,a,ai,u,o/
I wondered if it could be possible by referencing
s/(a)(e)(i)(o)(u)/(..)/, but then I don't have a reference for "ai"
(from "i").
I could'n find a solution for this, other than splitting the regex
into 5 lines.
Does someone know an answer?
TIA,
Upro
------------------------------
Date: Thu, 16 Jan 2003 11:43:50 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Is logic in regular expression possible?
Message-Id: <b065tm$fjq$1@korweta.task.gda.pl>
In article <bc3e2bd9.0301160338.1c8fb98b@posting.google.com>, Michael
J. wrote:
> Hi all!
>
> I wonder if the following is possible:
>
> I havea word, let's say "hello", and I want to write a regex that
> replaces vowel in the following manner:
> a -> e
> e -> a
> i -> ai
> o -> u
> u -> o
>
> ... and I'd like to do it in one line, like this:
> s/a,e,i,o,u/e,a,ai,u,o/
my %conv = ( a => 'e',
e => 'a',
i => 'ai',
o => 'u',
u => 'o' );
s/([aeiou])/$conv{$1}/g;
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: 16 Jan 2003 12:45:52 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Is logic in regular expression possible?
Message-Id: <slrnb2dah9.jvp.abigail@alexandra.abigail.nl>
Michael J. (upro@gmx.net) wrote on MMMCDXXV September MCMXCIII in
<URL:news:bc3e2bd9.0301160338.1c8fb98b@posting.google.com>:
$$ Hi all!
$$
$$ I wonder if the following is possible:
$$
$$ I havea word, let's say "hello", and I want to write a regex that
$$ replaces vowel in the following manner:
$$ a -> e
$$ e -> a
$$ i -> ai
$$ o -> u
$$ u -> o
$$
$$ ... and I'd like to do it in one line, like this:
$$ s/a,e,i,o,u/e,a,ai,u,o/
$$
$$ I wondered if it could be possible by referencing
$$ s/(a)(e)(i)(o)(u)/(..)/, but then I don't have a reference for "ai"
$$ (from "i").
$$
$$ I could'n find a solution for this, other than splitting the regex
$$ into 5 lines.
tr/aeou/eauo/; s/i/ai/g;
If you insist in having one statement, just write:
tr/aeou/eauo/ xor s/i/ai/g;
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: 16 Jan 2003 13:08:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Is logic in regular expression possible?
Message-Id: <b06art$23k$1@mamenchi.zrz.TU-Berlin.DE>
Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in comp.lang.perl.misc:
> In article <bc3e2bd9.0301160338.1c8fb98b@posting.google.com>, Michael
> J. wrote:
> > Hi all!
> >
> > I wonder if the following is possible:
> >
> > I havea word, let's say "hello", and I want to write a regex that
> > replaces vowel in the following manner:
> > a -> e
> > e -> a
> > i -> ai
> > o -> u
> > u -> o
> >
> > ... and I'd like to do it in one line, like this:
> > s/a,e,i,o,u/e,a,ai,u,o/
>
>
> my %conv = ( a => 'e',
> e => 'a',
> i => 'ai',
> o => 'u',
> u => 'o' );
>
>
> s/([aeiou])/$conv{$1}/g;
...or, if it *must* be one line,
s/([aeiou])/{a=>'e',e =>'a',i=>'ai',o=>'u',u=>'o'}->{ $1}/eg;
Anno
------------------------------
Date: 16 Jan 2003 08:28:36 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Outputting a binary file to the browser
Message-Id: <b05qfk$9i6$1@nets3.rz.RWTH-Aachen.DE>
Also sprach AG:
> In my PHP script, the readfile() function does the job
> after appropriate headers, no matter what the format of the file is.
>
> However, my perl script refuses to output zip and rar files. I wonder if anyone
> can tell me the appropriate way to output these files.
>
> Below is the snippet of my cgi code:
>
> binmode(FILE);
> binmode(STDOUT);
>
>
> print STDOUT while(<FILE>);
> close(FILE);
Perl does not automatically prepend an appropriate response header to
the actual data. You have to do that yourself. Add:
print "Content-type: application/zip\n\n";
before printing the actual data. I don't know the content-type for rar
though, application/rar perhaps.
But perhaps you are better off using read() instead of the angle
operator for binary files:
my $buf;
print STDOUT $buf while read FILE, $buf, 4096;
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
Date: Thu, 16 Jan 2003 08:48:13 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Outputting a binary file to the browser
Message-Id: <1fovhv9.1whhfybqkl0l2N%tony@svanstrom.com>
Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
> I don't know the content-type for rar though, application/rar perhaps.
application/x-rar-compressed
--
# Per scientiam ad libertatem! // Through knowledge towards freedom! #
# Genom kunskap mot frihet! =*= (c) 1999-2002 tony@svanstrom.com =*= #
perl -e'print$_{$_} for sort%_=`lynx -source svanstrom.com/t`'
------------------------------
Date: Thu, 16 Jan 2003 19:22:03 +1100
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: perl and the genome project
Message-Id: <bigiain-0B0617.19220316012003@nasal.pacific.net.au>
In article <86y95mx4j1.fsf@benburb.demon.co.uk>,
Joe Mc Cool <joe@benburb.demon.co.uk> wrote:
> Joe Mc Cool <joe@benburb.demon.co.uk> writes:
>
> > Please,
> >
> > lurking in this newsgroup and google searches lead me to believe that
> > Perl is being used quite a bit in the genome project. Where can I get
> > an overview of its use there ?
> >
> > I have to write a newspaper article - so I need material for the
> > general reader, not nitty gritties.
>
> Contacts in the UK are particularly useful.
At the Open Source Conference last year, a guy called Jim Kent and
another guy who's name I've forgotten (who was from the UK) gave a
keynote talk about perl and the human genome project.
<http://www.oreillynet.com/pub/a/network/2002/04/05/kent.html>
is the only reference I can google up quickly...
See if you can dig up the conference proceedings somewhere...
big
------------------------------
Date: 16 Jan 2003 04:48:53 -0800
From: entfred@hotmail.com (Entfred)
Subject: perl cgi redirect to variables instead of displaying HTML question
Message-Id: <d6e12cad.0301160448.11191396@posting.google.com>
I have a CGI perl program which has a form.
The form accepts input parameters that are passed to
a search engine. The search engine is a CGI program
that queries a database.
When my CGI program calls the search engine via a form using
hidden fields, at that point, control is passed to the search engine.
The search engine displays its results to the screen in html format.
Question - Is there any way for me to redirect the output of
the search engine results to variables inside my perl program
rather than the data going to the screen? This way, I could
manipulate the returned data from the search engine.
Thanks for any tips on how to do this!
-- Entfred
------------------------------
Date: 16 Jan 2003 01:32:44 -0800
From: jsn@microlib.demon.co.uk (Jason Singleton)
Subject: Re: Problem with DBI
Message-Id: <5b7e0283.0301160132.20a815d0@posting.google.com>
Jeff Zucker <jeff@vpservices.com> wrote in message news:<3E25A087.3010802@vpservices.com>...
> Jason Singleton wrote:
>
> > Can't locate auto/DBI/prepare.al in @INC (@INC contains: C:/Perl/lib
> > C:/Perl/site/lib . C:/Apache2/cgi-bin/WebOPAC/packages) at
> > drivers/text.pl line 27 Compilation failed in require at
> > C:/Apache2/cgi-bin/WebOPAC/webopac.cgi line 69.
>
>
> It looks like DBI is not installed, use PPM to install it if you are
> using ActiveState.
DBI works fine with a ADO connection it's when I try to use AnyData to
access a PIPE deliminated file.
------------------------------
Date: Thu, 16 Jan 2003 23:02:43 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: Renaming files *.txt to 1234.txt
Message-Id: <b06715$lq4g7$1@ID-172104.news.dfncis.de>
"Josef Möllers" <josef.moellers@fujitsu-siemens.com> wrote in message
news:3E25652E.EFFD736@fujitsu-siemens.com...
Bernard El-Hagin wrote:
>
> In article <3E254E67.6D2926BC@fujitsu-siemens.com>, Josef Möllers wrote:
> > Paul Tomlinson wrote:
> >>
> >> Renaming files *.txt to 1234.txt
> >>
> >> Hello,
> >>
> >> I need to rename every .txt file in a directory to 1234.txt. I
understand
> >> that this will cause some files to get overridden, but this is ok. Is
there
> >> any one line expression that will do this sort of thing for me?
> >
> > map { rename $_, "1234.txt" } (<*.txt>);
>
> Or:
>
> rename $_, '1234.txt' for glob('*.txt');
Yes, definitely TMTOWTDI.
It's exactly the same number of characters, though B-{)
or to save 6 characters.
rename $_, '1234.txt' for <*.txt>;
------------------------------
Date: Thu, 16 Jan 2003 23:04:13 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: Renaming files *.txt to 1234.txt
Message-Id: <b0673u$m8l11$1@ID-172104.news.dfncis.de>
"Paul Tomlinson" <rubberducky703@hotmail.com> wrote in message
news:b03hjr$kt805$1@ID-116287.news.dfncis.de...
> Renaming files *.txt to 1234.txt
>
> Hello,
>
> I need to rename every .txt file in a directory to 1234.txt. I understand
> that this will cause some files to get overridden, but this is ok. Is
there
> any one line expression that will do this sort of thing for me?
You've got plenty of Perl answers, but I'm beating my head as to why you
ever want/need to do something like this.
------------------------------
Date: Thu, 16 Jan 2003 13:30:55 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Renaming files *.txt to 1234.txt
Message-Id: <3E26A5FF.7E995087@fujitsu-siemens.com>
Tintin wrote:
> =
> "Paul Tomlinson" <rubberducky703@hotmail.com> wrote in message
> news:b03hjr$kt805$1@ID-116287.news.dfncis.de...
> > Renaming files *.txt to 1234.txt
> >
> > Hello,
> >
> > I need to rename every .txt file in a directory to 1234.txt. I under=
stand
> > that this will cause some files to get overridden, but this is ok. I=
s
> there
> > any one line expression that will do this sort of thing for me?
> =
> You've got plenty of Perl answers, but I'm beating my head as to why yo=
u
> ever want/need to do something like this.
"There are more things in heaven and earth, Horatio, than are dreamt of
in your philosophy." Hamlet, Act 1, Scene 5
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Thu, 16 Jan 2003 09:09:52 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: save and run bytocode
Message-Id: <b05skm$q69$1@news.dtag.de>
Benjamin Goldberg wrote:
> Actually, the big advantage is not avoiding the *fork* to perl, it's
> avoiding the *exec* to perl.
>
> Starting a new process (fork) is very fast and lightweight on all modern
> unices. However, loading a new program image from disk (exec) into that
> newly started process is a major speed hit.
Right *fork* was the wrong word obviously. Thanx.
>>srand 108641088; print chr int rand 256 for qw<J A P H>
>
>
> This prints "_+4-", which is probably not the right thing :)
>
> (Actually, it prints chr(232).chr(191).chr(52).chr(202), but my
> newsreader munges it when I try to paste in that garbage).
I know, its very system dependend. I consider that a feature :)
Actually, I asked about it in this group any consensus was, that if it
wouldnt work for somebody, they should be able to guess what it should
do and find the right srand value.
> Although srand and rand don't use the same algorithms on all platforms,
> you *could* have found a way to ensure that it would print normal ascii
> characters on all platforms.
>
> For example, on windows with ActiveState Perl, the following works:
> srand(555385); print chr(ord('A')+rand 26) for <J A P H>;
> And on other platforms, with different srand() and rand() functions, it
> will likely print out 4 different letters -- but these will be ascii
> letters, not "real" garbage.
Another advantage of this is obviously that with rand 26 the four
letters are much easier to find, but then again its kinda uncool.
> PS: The qw in front of <J A P H> isn't necessary, at least on those perl
> platforms which use it's own builtin glob() function.
Thanx for that one.
->malte
------------------------------
Date: Thu, 16 Jan 2003 13:16:22 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Storable.pm
Message-Id: <b06bcq$bca$1@newshost.mot.com>
Hello World!
I don't understand what $hashref means in the Storable docs. If I want to
store %vars, and retrieve it later I thought I should do this...
_____________
use strict;
use warnings;
use Storable;
my %vars;
# Load saved variables, or use default values.
if (-e "saved.txt") {
print "Saved values found\n\n";
%vars = retrieve('saved.txt');
} else {
print "Using default values\n\n";
%vars = (
dog_name => ["Please enter your dog's name: ", "Rover"],
fav_food => ["What is your favourite food? ", "Cheese"],
testicles => ["How many testicles do you have? ", 3],
fear => ["What is your biggest fear? ", "Elephants"],
)
}
store \%vars, 'saved.txt';
print "\nsave complete\n";
______________
But when I run it, I get this...
D:\Perl\My Scripts\Learning>perl save-vars.pl
Using default values
save complete
D:\Perl\My Scripts\Learning>perl save-vars.pl
Saved values found
Reference found where even-sized list expected at save-vars.pl line 10.
save complete
D:\Perl\My Scripts\Learning>
What am I doing wrong?
Thanks.
R.
------------------------------
Date: Thu, 16 Jan 2003 09:16:11 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: use constant?
Message-Id: <b05t0g$s4l$1@news.dtag.de>
qjzhu wrote:
> Hi folks,
>
> Please kindly point out what's wrong.
>
> Header.pm:
>
> our $va = 1;
> use constant CONS => 1;
>
> test.pl:
>
> use warnings;
> require Header;
> if ($va == CONS) {
$va doesnt exist here, its visibility is lexically scoped to the file
Header.pm.
use strict; :)
->malte
------------------------------
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 4413
***************************************