[22308] in Perl-Users-Digest
Perl-Users Digest, Issue: 4529 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 7 09:44:54 2003
Date: Fri, 7 Feb 2003 06:12:42 -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 Fri, 7 Feb 2003 Volume: 10 Number: 4529
Today's topics:
Quick regexp question <mr@sandman.net>
Re: Quick regexp question <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: Quick regexp question <josef.moellers@fujitsu-siemens.com>
Re: Quick regexp question <josef.moellers@fujitsu-siemens.com>
Re-running DBI 'prepare' on same statement handle (John Ramsden)
Re: Re-running DBI 'prepare' on same statement handle <rereidy@indra.com>
Re: sharing variables (Tad McClellan)
Re: Simple regexp gots me stuck... (Anno Siegel)
Re: Simple regexp gots me stuck... (OJ)
Re: Simple regexp gots me stuck... (Anno Siegel)
Re: Some confusion <newsmonkey@vboston.com>
Re: string in datei (Helgi Briem)
Re: string in datei <tassilo.parseval@post.rwth-aachen.de>
Re: string in datei <flavell@mail.cern.ch>
Re: string in datei (Helgi Briem)
Unable to install Compress::Bzip2 <kjetilsk.skotheim@usit.uio.no>
WAV to MP3 converters <d_changer@dsl.pipex.com>
Re: WAV to MP3 converters <w_ichmann@uni-wuppertal.de>
Re: Why no perl function to detect numeric or string? <spikey-wan@bigfoot.com>
Re: Why no perl function to detect numeric or string? <spamfilter@cheiron-it.nl>
Re: Why no perl function to detect numeric or string? <jurgenex@hotmail.com>
Re: Why no perl function to detect numeric or string? (Jay Tilton)
Re: Why no perl function to detect numeric or string? (Anno Siegel)
Re: Why no perl function to detect numeric or string? <spamfilter@cheiron-it.nl>
Re: Why no perl function to detect numeric or string? (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 07 Feb 2003 12:13:48 +0100
From: Sandman <mr@sandman.net>
Subject: Quick regexp question
Message-Id: <mr-C60B22.12134807022003@news.fu-berlin.de>
I have four string:
Managing director: John Jensen
Supreme VP: Tim Adams
Sales key person: Math Edwards
Junk: Junk
And I am in a while that has one of the above in $_. Now, I would like to
remove everything up to the :-character, if it contains two or three words
(i.e. not 'Junk: Junk'). First I did a:
s/^(.*?)://;
$title=$1;
(since I want to save the snipped string)
But then I tried something like:
s/^(\w+{2,3})://;
Which of course fails, since I have two quantifiers. I am looking for an
sequence matching an entire word that I can quantify, unless you have a better
way to do the above. In the end, all I want to do is set $1 to two or three
words that need to be found before the :-character.
--
Sandman[.net]
------------------------------
Date: Fri, 7 Feb 2003 11:17:59 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Quick regexp question
Message-Id: <Xns931B7C6D5A13Belhber1lidotechnet@62.89.127.66>
Sandman wrote:
> I have four string:
>
> Managing director: John Jensen
> Supreme VP: Tim Adams
> Sales key person: Math Edwards
> Junk: Junk
>
> And I am in a while that has one of the above in $_. Now, I would like
> to remove everything up to the :-character, if it contains two or
> three words (i.e. not 'Junk: Junk'). First I did a:
>
> s/^(.*?)://;
> $title=$1;
If I understand correctly, all you have to do is make the match greedy.
s/^(.*)://;
$title = $1;
You should also make sure that you got a match before you use $1. Maybe:
$title = $1 if s/^(.*)://;
--
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Fri, 07 Feb 2003 12:40:32 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Quick regexp question
Message-Id: <3E439B30.5F73499E@fujitsu-siemens.com>
Sandman wrote:
> =
> I have four string:
> =
> Managing director: John Jensen
> Supreme VP: Tim Adams
> Sales key person: Math Edwards
> Junk: Junk
> =
> And I am in a while that has one of the above in $_. Now, I would like =
to
> remove everything up to the :-character, if it contains two or three wo=
rds
> (i.e. not 'Junk: Junk'). First I did a:
> =
> s/^(.*?)://;
> $title=3D$1;
> =
> (since I want to save the snipped string)
> But then I tried something like:
> =
> s/^(\w+{2,3})://;
> =
> Which of course fails, since I have two quantifiers. I am looking for a=
n
> sequence matching an entire word that I can quantify, unless you have a=
better
> way to do the above. In the end, all I want to do is set $1 to two or t=
hree
> words that need to be found before the :-character.
If you have "two or three" words, how about "two or more"? Then you have
at least one separator, the pattern to match would be /.*\s.*:/
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Fri, 07 Feb 2003 12:44:16 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Quick regexp question
Message-Id: <3E439C10.3B65FB76@fujitsu-siemens.com>
Sandman wrote:
> =
> I have four string:
> =
> Managing director: John Jensen
> Supreme VP: Tim Adams
> Sales key person: Math Edwards
> Junk: Junk
> =
> And I am in a while that has one of the above in $_. Now, I would like =
to
> remove everything up to the :-character, if it contains two or three wo=
rds
> (i.e. not 'Junk: Junk'). First I did a:
> =
> s/^(.*?)://;
> $title=3D$1;
> =
> (since I want to save the snipped string)
> But then I tried something like:
> =
> s/^(\w+{2,3})://;
> =
> Which of course fails, since I have two quantifiers. I am looking for a=
n
> sequence matching an entire word that I can quantify, unless you have a=
better
> way to do the above. In the end, all I want to do is set $1 to two or t=
hree
> words that need to be found before the :-character.
I addition to my other posting:
s/^(\w+(\s+\w+){1,2})://;
Input:
Managing director: John Jensen
Supreme VP: Tim Adams
Sales key person: Math Edwards
Junk: Junk
Output:
John Jensen
Tim Adams
Math Edwards
Junk: Junk
HTH,
Josef
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 7 Feb 2003 03:03:13 -0800
From: john_ramsden@sagitta-ps.com (John Ramsden)
Subject: Re-running DBI 'prepare' on same statement handle
Message-Id: <d27434e.0302070303.3ed0fc2f@posting.google.com>
I have a monitoring app which needs to store statement handles
for DBI $dbh->prepare() calls, but on occasion the WHERE clause
of some SQL statements will change and when this happens the app
must rerun every prepare().
(There are good reasons for this, in the context of the overall
design and the purpose of the program; so please don't bother
asking "why would you want to do that?".)
What concerns me slightly though is that if the same statement
handle is assigned the value returned by a new prepare, will the
memory associated with the preceding prepare be freed? Or will
it hang around, and possibly cause problems when the statement
is executed?
In practice this re-prepare shouldn't happen very often during
the lifetime of the program; but if there is some way I can
explicitly ditch any resources associated with a prepare
before rerunning it, I'd feel more comfortable.
(I tried $sth->free(); but that function name isn't recognized.
Would either of 'undef $sth' or '$sth->destroy()' work?)
Cheers
John Ramsden (john_ramsden@sagitta-ps.com)
------------------------------
Date: Fri, 07 Feb 2003 04:52:56 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Re-running DBI 'prepare' on same statement handle
Message-Id: <3E439E18.8090301@indra.com>
See below ...
John Ramsden wrote:
> I have a monitoring app which needs to store statement handles
> for DBI $dbh->prepare() calls, but on occasion the WHERE clause
> of some SQL statements will change and when this happens the app
> must rerun every prepare().
>
> (There are good reasons for this, in the context of the overall
> design and the purpose of the program; so please don't bother
> asking "why would you want to do that?".)
>
> What concerns me slightly though is that if the same statement
> handle is assigned the value returned by a new prepare, will the
> memory associated with the preceding prepare be freed? Or will
> it hang around, and possibly cause problems when the statement
> is executed?
>
> In practice this re-prepare shouldn't happen very often during
> the lifetime of the program; but if there is some way I can
> explicitly ditch any resources associated with a prepare
> before rerunning it, I'd feel more comfortable.
>
> (I tried $sth->free(); but that function name isn't recognized.
> Would either of 'undef $sth' or '$sth->destroy()' work?)
Try $sth->finish
>
>
> Cheers
>
> John Ramsden (john_ramsden@sagitta-ps.com)
--
Ron Reidy
Oracle DBA
------------------------------
Date: Thu, 6 Feb 2003 23:03:59 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: sharing variables
Message-Id: <slrnb46fhv.g3s.tadmc@magna.augustmail.com>
Jeff Thies <cyberjeff@sprintmail.com> wrote:
> I'll look through the scoping, I'm rather confused at the moment!
"Coping with Scoping":
http://perl.plover.com/FAQs/Namespaces.html
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 7 Feb 2003 08:39:10 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Simple regexp gots me stuck...
Message-Id: <b1vrbe$87u$1@mamenchi.zrz.TU-Berlin.DE>
OJ <orljustin@aol.com> wrote in comp.lang.perl.misc:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message
> news:<b1ui9j$bbg$3@mamenchi.zrz.TU-Berlin.DE>...
> > OJ <orljustin@aol.com> wrote in comp.lang.perl.misc:
> > > Heya,
> > >
> > > Can't figure out why this does not return the image path only in $1.
> Any clue?
> > >
> > > #!/usr/local/bin/perl
> > >
> > > $t = "img SRC=\"/Images/tmp.gif\" ALT=\"avast ye scurvy dogs\"";
> > > $t=~/src.*?=.*?"(.*)[^ ]?"/i;
> > ^^^^
> > The underlined part captures everything after '"' up to the last '"' in
> > a greedy way, since the following "[^ ]?" is optional.
>
> Hey again,
>
> Why is it optional?
Because of the final "?".
> I was just going for "the first quote with no
> white space before it. Actually, I tried your suggestion below
> initially, but got the same result.
That's because my suggestion is wrong. It should have been
$t=~/src.*?=.*?"(.*?)"/i;
Anno
------------------------------
Date: 7 Feb 2003 05:27:04 -0800
From: orljustin@aol.com (OJ)
Subject: Re: Simple regexp gots me stuck...
Message-Id: <77d3a68b.0302070527.53ed1173@posting.google.com>
Michael Budash <mbudash@sonic.net> wrote in message news:<mbudash-590282.19273506022003@typhoon.sonic.net>...
> In article <77d3a68b.0302061859.2977ed3@posting.google.com>,
> orljustin@aol.com (OJ) wrote:
>
> > anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message
> > news:<b1ui9j$bbg$3@mamenchi.zrz.TU-Berlin.DE>...
> > > OJ <orljustin@aol.com> wrote in comp.lang.perl.misc:
> > > > Heya,
> > > >
> > > > Can't figure out why this does not return the image path only in $1. Any
> > > > clue?
> > > >
> > > > #!/usr/local/bin/perl
> > > >
> > > > $t = "img SRC=\"/Images/tmp.gif\" ALT=\"avast ye scurvy dogs\"";
> > > > $t=~/src.*?=.*?"(.*)[^ ]?"/i;
> > > ^^^^
> > > The underlined part captures everything after '"' up to the last '"' in
> > > a greedy way, since the following "[^ ]?" is optional.
> >
> > Hey again,
> >
> > Why is it optional?
>
> the question mark specifies it as optional
>
> perldoc perlre
Hey,
I thought the question mark marked it as non-greedy.
oj
>
> hth-
------------------------------
Date: 7 Feb 2003 13:52:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Simple regexp gots me stuck...
Message-Id: <b20dm5$nf6$1@mamenchi.zrz.TU-Berlin.DE>
OJ <orljustin@aol.com> wrote in comp.lang.perl.misc:
> Michael Budash <mbudash@sonic.net> wrote in message
> news:<mbudash-590282.19273506022003@typhoon.sonic.net>...
> > In article <77d3a68b.0302061859.2977ed3@posting.google.com>,
> > orljustin@aol.com (OJ) wrote:
> >
> > > anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message
> > > news:<b1ui9j$bbg$3@mamenchi.zrz.TU-Berlin.DE>...
> > > > OJ <orljustin@aol.com> wrote in comp.lang.perl.misc:
> > > > > Heya,
> > > > >
> > > > > Can't figure out why this does not return the image path only in
> $1. Any
> > > > > clue?
> > > > >
> > > > > #!/usr/local/bin/perl
> > > > >
> > > > > $t = "img SRC=\"/Images/tmp.gif\" ALT=\"avast ye scurvy dogs\"";
> > > > > $t=~/src.*?=.*?"(.*)[^ ]?"/i;
> > > > ^^^^
> > > > The underlined part captures everything after '"' up to the last '"' in
> > > > a greedy way, since the following "[^ ]?" is optional.
> > >
> > > Hey again,
> > >
> > > Why is it optional?
> >
> > the question mark specifies it as optional
> >
> > perldoc perlre
>
> Hey,
>
> I thought the question mark marked it as non-greedy.
A question mark following a quantifier makes the quantifier non-greedy.
A question mark following a single pattern makes it optional.
Read perlre, please.
Anno
------------------------------
Date: Wed, 5 Feb 2003 16:36:51 -0500
From: "Jim Davis" <newsmonkey@vboston.com>
Subject: Re: Some confusion
Message-Id: <b1s05n02iu0@enews3.newsguy.com>
"Smiley" <smiley@uvgotemail.com> wrote in message
news:v42k6nki9dnm55@corp.supernews.com...
>
> "Jim Davis" <newsmonkey@vboston.com> wrote in message
> news:b1rdhc012ng@enews1.newsguy.com...
> >
> > In addition, due to the burst, there are a LOT of orphaned technologies
> out
> > there. Tools like Tango, Lasso, WebPlus, SilverStream, etc all got used
> by
> > somebody, somewhere. Now these companies are finding it nigh-impossible
> to
> > find people qualified to work on this systems. This leaves two holes
> open:
> > one for people that actually do now these systems, and another for
people
> > able to convert them to newer, better supported systems.
> >
> > There's at least some contracting work out there for this as my last few
> > inquires have been of this nature.
>
> Great information Jim, thanks. Can you confirm or deny, though, whether
> there are programmers out there making minimum wage? Or does the very low
> end still pay higher than minimum wage?
I'm sure you can find somebody... however remember that minimum wage really
doesn't apply to programmers in general.
I've never seen a non-salaried permanent programming position. Salaried
positions are not affected by minimum wage. Technically you can assume a
"minimum wage type salary" at about $11,000 gross, but I've never seen a
programming job for that little. Even the very low end (at least here)
seems to start in the low 20s.
Contract positions are negotiated by the parties involved - again not
affected by minimum wage (if you want to bid $2 and hour for a contract
that's fine). Again, you'd have to contract for a position at less than
$5.15 an hour (isn't that the current minimum wage?) to be making it.
Personally the lowest I've known somebody to be working for was $23k/year
but I think that they were getting shafted (and that wasn't even for
programming). My current company hasn't hired a programmer for less than
$40k/year as far as I know.
As for contracting it varies. I generally ask $100/hour but I don't really
need the work (so when I do get 100/hour it's a very nice bonus). If I
needed the work I'd probably go down to $50/hour... if I REALLY needed the
work (as in "if I don't a check soon I'm on the street") sure, I'd work for
minimum wage (if doing so would help). However if it came to that I'd
probably take a greater-than-minimum wage gig at McDonald's long before
that.
Jim Davis
--
President, Depressed Press of Boston: http://www.DepressedPress.com/
Webmaster, First Night Boston: http://www.firstnight.org/
Senior Consultant, Metlife eCommerce IT: http://www.metlife.com/
------------------------------
Date: Fri, 07 Feb 2003 08:28:17 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: string in datei
Message-Id: <3e436b93.749204258@news.cis.dfn.de>
On Thu, 6 Feb 2003 15:20:04 +0000 (UTC),
mauzo@ux-ma160-17.csv.warwick.ac.uk (Ben Morrow) wrote:
>>Trying to impose regional (language-specific) standards on a
>>non-regionalized group is representative of the bad kinds of
>>Americans. I'm sorry to see such arrogance in England too.
>
>It was not arrogance. I was under the impression that discussions
>in the non-regional groups were conventionally carried out in
>English. It seems sensible to me that there should be a group
>for discussion of Perl in English, a group in German, a group in
>French, &c. That the English group happens to be
>called comp.lang.perl.misc rather than en.comp.lang.perl.misc
>I would have put down to historical accident.
It might also be noted that the name of the group,
comp.lang.perl.misc, only parses/expands to:
computers.languages.perl.miscellaneous
in one language, English. It makes no sense in
any other language. If it were known as:
tolvur.mal.perl.ymislegt, I might surmise that the default
language was Icelandic.
One might also note that *all* the reserved words in
Perl (and almost every other programming language I
am aware of) ise dereived from English, so at least
some command of English is necessary to use it.
Like it or not, we speakers of marginalised languages
like Icelandic and German (he he*) will have to deal
with the fact that English has become the standard
language of technical discourse, much like Latin was
the standard language of academics in the middle
ages.
*A little joke at the German's expense. There are
about 300,000 Icelandic speakers in the world,
but at least 100,000,000 native speakers of German,
plus millions more who like me, know it well enough
to get by in a restaurant, but not well enough to
hold up a technical discussion in it.
--
Regards, Helgi Briem
helgi AT decode DOT is
------------------------------
Date: 7 Feb 2003 09:37:35 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: string in datei
Message-Id: <b1vuov$29u$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Helgi Briem:
> On Thu, 6 Feb 2003 15:20:04 +0000 (UTC),
> mauzo@ux-ma160-17.csv.warwick.ac.uk (Ben Morrow) wrote:
>>It was not arrogance. I was under the impression that discussions
>>in the non-regional groups were conventionally carried out in
>>English. It seems sensible to me that there should be a group
>>for discussion of Perl in English, a group in German, a group in
>>French, &c. That the English group happens to be
>>called comp.lang.perl.misc rather than en.comp.lang.perl.misc
>>I would have put down to historical accident.
>
> It might also be noted that the name of the group,
> comp.lang.perl.misc, only parses/expands to:
>
> computers.languages.perl.miscellaneous
>
> in one language, English. It makes no sense in
> any other language. If it were known as:
> tolvur.mal.perl.ymislegt, I might surmise that the default
> language was Icelandic.
But there is also de.comp.lang.perl.misc which expands to:
deutsch.computers.languages.perl.miscellaneous
Chopping off the plural 's' of computers could make it a German word,
but such a transformation will be extremely hard for a word as odd as
'miscellaneous'. ;-)
In case of Germans posting in German into this group, it is perhaps best
to point them to the above German group. Hmmh, Helgi, I guess there
isn't a 'is.comp.lang.perl.*' hierarchy, eh? ;-)
> One might also note that *all* the reserved words in
> Perl (and almost every other programming language I
> am aware of) ise dereived from English, so at least
> some command of English is necessary to use it.
>
> Like it or not, we speakers of marginalised languages
> like Icelandic and German (he he*) will have to deal
> with the fact that English has become the standard
> language of technical discourse, much like Latin was
> the standard language of academics in the middle
> ages.
Indeed. In the de.comp.lang.perl.* groups however there have been quite
a number of people lately asking for German Perl documentation. That's a
bit of a problem because the perldocs (be they as brilliant as they are)
aren't available in German (yet?). There has been an attempt to
translate them but I don't know how far they eventually got. You must be
both skilled in languages and Perl to do it properly.
> *A little joke at the German's expense. There are
> about 300,000 Icelandic speakers in the world,
> but at least 100,000,000 native speakers of German,
> plus millions more who like me, know it well enough
> to get by in a restaurant, but not well enough to
> hold up a technical discussion in it.
Ah, but this number does impose a problem on Germans: Because the group
of German natives is 'important' enough, most things (think of movies)
are translated into German. I heard that this is much less common for
smaller language-groups (Icelandic is probably a very good example
here) so when they want to watch a movie, they get it subtitled into
their language. Is that in fact true? The consequences are that speakers
of those important languages are less forced to learn a lingua franca
such as English is (and we can't pick it up en-passant either because of
the ubiquity of our native tongue).
I always observe how well people with a more 'obscure' language
background speak foreign languages. It's really a shame sometimes:
Whenever you hear the news on TV and a foreign statesman or so is making
even the most basic statement in English, you can be sure that a
dolmetscher is already there translating it.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Fri, 7 Feb 2003 11:27:16 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: string in datei
Message-Id: <Pine.LNX.4.53.0302071111140.31652@lxplus080.cern.ch>
On Feb 7, Helgi Briem inscribed on the eternal scroll:
> One might also note that *all* the reserved words in
> Perl (and almost every other programming language I
> am aware of) ise dereived from English, so at least
> some command of English is necessary to use it.
Somewhere in my archive I have a programming manual for the old
valve-based ("vacuum tube" for transpondians) G3 computer that was at
the Max-Planck institute in Munich. A treasure-house of German
computing terms, many of which didn't make it into the mainstream
(e.g "Keller" = stack).
("Herr Flavell, die Daten sind jetzt gepanscht" -
handwritten note from computer operator.)
------------------------------
Date: Fri, 07 Feb 2003 13:37:01 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: string in datei
Message-Id: <3e43b4ed.5973429@news.cis.dfn.de>
On 7 Feb 2003 09:37:35 GMT, "Tassilo v. Parseval"
<tassilo.parseval@post.rwth-aachen.de> wrote:
>In case of Germans posting in German into this group, it is perhaps best
>to point them to the above German group. Hmmh, Helgi, I guess there
>isn't a 'is.comp.lang.perl.*' hierarchy, eh? ;-)
No, but there is an is.tolvur.* hierarchy that has
some computer groups in. Largely moribund, I'm afraid.
Iceland proved too small to sustain an active Usenet
community once the web-based forums had reached
a certain critical size. They are thriving, although
to me no web-based forum can ever approach Usenet
for functionality, responsiveness and ease of use.
Ah well.
>Ah, but this number does impose a problem on Germans: Because the group
>of German natives is 'important' enough, most things (think of movies)
>are translated into German. I heard that this is much less common for
>smaller language-groups (Icelandic is probably a very good example
>here) so when they want to watch a movie, they get it subtitled into
>their language. Is that in fact true?
This is true and the reason why people from small countries
like Iceland, Denmark or the Netherlands, by and large,
speak better English than people from the larger countries
like Germany, France and Spain where they dub TV shows
and films. 12 year old Icelandic children often speak
fluent English when they have their first English lesson
at school. My son certainly did.
But all this is OT and I think it's time to quit or take
it to private e-mail.
--
Regards, Helgi Briem
helgi AT decode DOT is
------------------------------
Date: Wed, 05 Feb 2003 21:39:39 GMT
From: Kjetil Skotheim <kjetilsk.skotheim@usit.uio.no>
Subject: Unable to install Compress::Bzip2
Message-Id: <1105_1044481179@nntp.uio.no>
I use Compress::Zlib all the time, but want to try Compress::Bzip2
for better (and slower) compression. I try to install as root like this:
# perl -MCPAN -e shell
cpan> install Compress::Bzip2
But the I get:
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.6.1/i686-linux -I/usr/lib/perl5/5.6.1 -e
'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/test....Can't load 'blib/arch/auto/Compress/Bzip2/Bzip2.so' for module Compress::Bzip2:
blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol: bzBuffToBuffCompress at /usr/lib/perl5/5.6.1/i686-
linux/DynaLoader.pm line 206.
at t/test.t line 8
Compilation failed in require at t/test.t line 8.
BEGIN failed--compilation aborted at t/test.t line 8.
t/test....dubious
Test returned status 255 (wstat 65280, 0xff00)
And the installation fails. What can be done?
(My perl version is 5.6.1, CPAN.pm version is 1.63,
kernel is 2.4.17 and RedHat is 7.2).
------------------------------
Date: Fri, 7 Feb 2003 11:21:41 -0000
From: "David Changer" <d_changer@dsl.pipex.com>
Subject: WAV to MP3 converters
Message-Id: <3e439706$0$4016$cc9e4d1f@news.dial.pipex.com>
Hi
Does anyone know where I can get some Perl modules to convert WAV to MP3 and
also play the Wav / MP3 files?
------------------------------
Date: Fri, 07 Feb 2003 12:32:16 +0100
From: Ingo Wichmann <w_ichmann@uni-wuppertal.de>
Subject: Re: WAV to MP3 converters
Message-Id: <b205o8$gqa$02$1@news.t-online.com>
David Changer schrieb:
> Does anyone know where I can get some Perl modules to convert WAV to MP3 and
> also play the Wav / MP3 files?
http://freshmeat.net/search/?q=mp3+wav&trove_cat_id=176§ion=trove_cat
Maybe there is something for you among them.
Ingo
--
Meine Mail-Adresse enthält keinen Unterstrich
------------------------------
Date: Fri, 7 Feb 2003 10:54:02 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Re: Why no perl function to detect numeric or string?
Message-Id: <b203a0$jj9$1@newshost.mot.com>
> EK> I'm curious philosophically, why is perl missing a way to find out
if a
> EK> variable is numeric or string?
>
> because there is (almost) no need for it.
>
> EK> Perl must do it internally to find out if a "==" or an "eq"
operation is
> EK> valid.
>
> sure, it has access to the *_OK flags in the SV. you can get at them
> with some modules.
>
> EK> If perl can't do something there's usually some fundamental reason.
>
> like no need for it. perl converts as needed and the coder shouldn't
> care.
In a script I'm writing, the user enters values for a ping test in a TK GUI.
They can enter a value for the number of pings to perform, the timeout
between pings, etc, etc.
If they put 'cheese' into the entry box for the number of pings they'd like
to perform, I get the following error...
Argument "cheese" isn't numeric in numeric le (<=) at D:\Perl\My Scripts...
Then my script informs them that: "cheese pings completed."
I would much rather have a popup window that tells them they're stupid, and
to enter a proper value into the entry box, wouldn't you?
So, you see, there IS a need for it.
I've had to write a series of regexs for each entry box. My life would have
been much easier if there was a simple check that they've entered a number,
or a whole number, as required.
R.
------------------------------
Date: Fri, 7 Feb 2003 12:13:07 +0100
From: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: Re: Why no perl function to detect numeric or string?
Message-Id: <3e4395c2$0$140$e4fe514c@dreader7.news.xs4all.nl>
"Martien Verbruggen" <mgjv@tradingpost.com.au> schreef:
> The fundamental reason is that it is the wrong question. From Perl's
> point of view there is no such thing as a "numeric" scalar. Internally
> in Perl, scalars can have numeric fields, which are currently valid or
> not, but that is an implementation detail that should not be exposed
> to the Perl programmer.
But then... why the difference in '==' and 'eq'?
--Frank
------------------------------
Date: Fri, 07 Feb 2003 11:29:06 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Why no perl function to detect numeric or string?
Message-Id: <6MM0a.3598$ta2.376@nwrddc01.gnilink.net>
Frank Maas wrote:
> "Martien Verbruggen" <mgjv@tradingpost.com.au> schreef:
>> The fundamental reason is that it is the wrong question. From Perl's
>> point of view there is no such thing as a "numeric" scalar.
>> Internally in Perl, scalars can have numeric fields, which are
>> currently valid or not, but that is an implementation detail that
>> should not be exposed to the Perl programmer.
>
> But then... why the difference in '==' and 'eq'?
Because 12 is '== ' to 00012 but it is not eq to '00012'.
This is more obvious for greater/smaller:
234 is '<' than 1234 but it is 'gt' than 1234.
jue
------------------------------
Date: Fri, 07 Feb 2003 12:21:18 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Why no perl function to detect numeric or string?
Message-Id: <3e439ea6.106480384@news.erols.com>
"Richard S Beckett" <spikey-wan@bigfoot.com> wrote:
: In a script I'm writing, the user enters values for a ping test in a TK GUI.
: They can enter a value for the number of pings to perform, the timeout
: between pings, etc, etc.
:
: If they put 'cheese' into the entry box for the number of pings they'd like
: to perform, I get the following error...
:
: Argument "cheese" isn't numeric in numeric le (<=) at D:\Perl\My Scripts...
:
: Then my script informs them that: "cheese pings completed."
Most would not look for a distinction between "number" and "string" in
that case. They would look for the distinction between "digit" and
"non-digit."
The difference is subtle, but it's an example of using the right
terminology. Strings and numbers morph into one another seamlessly as
the code requires. The digit-ness of a character, on the other hand,
is never in doubt and will not change unless the program explicitly
alters it.
Another term to become familiar with is "data validation." That's
what you're really after. The string/number question is an X-Y
problem.
: I would much rather have a popup window that tells them they're stupid, and
: to enter a proper value into the entry box, wouldn't you?
Absolutely not. That is just bad UI design.
Either take steps that prevent the user from ever being able to enter
nonsense values (use a list box, for example), or accept anything that
comes in and do a sensible thing when it is nonsensical (falling back
to a default value, for example).
: I've had to write a series of regexs for each entry box.
Are the regexes all the same for each input, or does each input have
its own special set?
: My life would have
: been much easier if there was a simple check that they've entered a number,
: or a whole number, as required.
Make your own simple check and roll it off into a subroutine. How
hard can this be?
sub validate_number {
my($arg, $default) = @_;
my($valid) = $arg =~ /^(\d+)/;
return defined $valid ? $valid : $default;
}
print validate_number('cheese', 3);
------------------------------
Date: 7 Feb 2003 12:25:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Why no perl function to detect numeric or string?
Message-Id: <b208iu$ka3$1@mamenchi.zrz.TU-Berlin.DE>
Richard S Beckett <spikey-wan@bigfoot.com> wrote in comp.lang.perl.misc:
> > EK> I'm curious philosophically, why is perl missing a way to find out
> if a
> > EK> variable is numeric or string?
[...]
> > like no need for it. perl converts as needed and the coder shouldn't
> > care.
>
> In a script I'm writing, the user enters values for a ping test in a TK GUI.
> They can enter a value for the number of pings to perform, the timeout
> between pings, etc, etc.
>
> If they put 'cheese' into the entry box for the number of pings they'd like
> to perform, I get the following error...
>
> Argument "cheese" isn't numeric in numeric le (<=) at D:\Perl\My Scripts...
>
> Then my script informs them that: "cheese pings completed."
>
> I would much rather have a popup window that tells them they're stupid, and
> to enter a proper value into the entry box, wouldn't you?
>
> So, you see, there IS a need for it.
Well, of course the need to tell numbers from strings can come up in
a program, and it can be done as the faq and this thread have shown.
However, since Perl doesn't distinguish them, there is no systematic
need for a Perl primitive (like, for instance, defined()) to tell
them apart.
Anno
------------------------------
Date: Fri, 7 Feb 2003 13:37:34 +0100
From: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: Re: Why no perl function to detect numeric or string?
Message-Id: <3e43a8ee$0$118$e4fe514c@dreader4.news.xs4all.nl>
"Jürgen Exner" <jurgenex@hotmail.com> schreef in bericht
news:6MM0a.3598$ta2.376@nwrddc01.gnilink.net...
> Frank Maas wrote:
> > "Martien Verbruggen" <mgjv@tradingpost.com.au> schreef:
> >> The fundamental reason is that it is the wrong question. From Perl's
> >> point of view there is no such thing as a "numeric" scalar.
> >> Internally in Perl, scalars can have numeric fields, which are
> >> currently valid or not, but that is an implementation detail that
> >> should not be exposed to the Perl programmer.
> >
> > But then... why the difference in '==' and 'eq'?
>
> Because 12 is '== ' to 00012 but it is not eq to '00012'.
>
> This is more obvious for greater/smaller:
> 234 is '<' than 1234 but it is 'gt' than 1234.
Yes, I see your point. My remark was a more filosophical one: there is
a difference between '==' and 'eq' which makes that you cannot simply
say 'if ($a == $b)'. So the difference between textual and numerical
values is exposed to the programmer. Not that I really care, but one
could imagine another approach where '==' always means 'identical with
possible typecast to numeric value' and 'eq' always means 'textually
identical'. Thus 5 == 5, 'a' == 'a', 5 == '5', 5 == '005', not 'b' == 'a',
not 5 == 'a', 'a' eq 'a', 5 eq '5', not 5 eq '05' and so on. Then the
exposure of the underlying type is really gone.
I'll go and hide for the flames now ;-)
--Frank
------------------------------
Date: Fri, 7 Feb 2003 07:13:44 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Why no perl function to detect numeric or string?
Message-Id: <slrnb47c88.h54.tadmc@magna.augustmail.com>
Jürgen Exner <jurgenex@hotmail.com> wrote:
> Because 12 is '== ' to 00012
No it isn't.
You must have meant to say:
Because 10 is '== ' to 00012
or
Because 12 is '== ' to '00012'
heh.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 4529
***************************************