[16332] in Perl-Users-Digest
Perl-Users Digest, Issue: 3744 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 19 06:11:24 2000
Date: Wed, 19 Jul 2000 03:10:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964001417-v9-i3744@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 19 Jul 2000 Volume: 9 Number: 3744
Today's topics:
Re: Sign Up Script (Abigail)
Re: storing record <gellyfish@gellyfish.com>
Re: Unable to append <jaurangNOjaSPAM@crosswinds.net.invalid>
upper case first <mike.solomon@eps.ltd.uk>
Re: upper case first (jason)
Re: upper case first <mike.solomon@eps.ltd.uk>
Re: upper case first (Bernard El-Hagin)
Re: upper case first (jason)
Re: upper case first (Bernard El-Hagin)
Re: watch out for the mod operator! (Chest Rockwell)
Re: What does this mean? (Bernard El-Hagin)
Re: What does this mean? <uackermann@orga.com>
Where on the net can I <hansjakv@eunet.no>
Re: Where on the net can I (Bernard El-Hagin)
Re: Yet another string manipulation question - <anuragmenon@my-deja.com>
Re: Yet another string manipulation question - (Bernard El-Hagin)
Re: Yet another string manipulation question - (jason)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 19 Jul 2000 04:01:05 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Sign Up Script
Message-Id: <slrn8nap38.3do.abigail@alexandra.delanet.com>
MrClyde (mrclyde@bolomail.dyn.dhs.org) wrote on MMDXIV September MCMXCIII
in <URL:news:8l3dhj$thq$1@news.gate.net>:
)) Does anyone know where I can get a script to work with an account sign up
)) forms page? I need something that determines if the client's requested
)) account name is available and if 2 password enteries they are required to
)) fill in are identical prior to the form being processed.
Hire a programmer.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 19 Jul 2000 10:14:52 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: storing record
Message-Id: <8l3ric$tsm$1@orpheus.gellyfish.com>
On Tue, 18 Jul 2000 16:05:34 +0800 han wrote:
> Is it possible that perl can do just like cobol storing the db on the index
> file only?
>
Probably something like DBM is the nearest - check out the AnyDBM_File
manpage for more info ...
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Wed, 19 Jul 2000 01:06:46 -0700
From: Taurean <jaurangNOjaSPAM@crosswinds.net.invalid>
Subject: Re: Unable to append
Message-Id: <0091db33.00d590ef@usw-ex0108-061.remarq.com>
I've solved the problem. It's the permission problem. I
asked the administrator to add the write permission to the
database file and it worked!
Thanks everyone for your contributions. Case closed!
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Wed, 19 Jul 2000 09:01:04 +0100
From: "mike solomon" <mike.solomon@eps.ltd.uk>
Subject: upper case first
Message-Id: <8l3nb2$3jfmd$1@ID-36965.news.cis.dfn.de>
I need to convert a name to be lower case but with the first letter as
uppercase
I have written the following script that works but is very clumsy for a
simple operation
does anyone know of a better way to do it, I am sure there must be one !
#! /usr/local/bin/perl -w
use strict;
my $name = "mIcHael josepH soloMon";
my $newname = "";
my $count = 0;
my @sname = split(" ",$name);
for (@sname) {
$count++;
if ($count == 1) {
$newname = ucfirst lc $_;
} else {
$newname = $newname . " " . ucfirst lc $_;
}
}
print "$newname\n";
which gives Michael Joseph Solomon
Any help will be appreciated
Regards
Mike Solomon
------------------------------
Date: Wed, 19 Jul 2000 08:21:04 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: upper case first
Message-Id: <MPG.13e00244799b543e9896f7@news>
mike solomon wrote ..
>I need to convert a name to be lower case but with the first letter as
>uppercase
>
>I have written the following script that works but is very clumsy for a
>simple operation
>
>does anyone know of a better way to do it, I am sure there must be one !
>
>
>#! /usr/local/bin/perl -w
>use strict;
>
>my $name = "mIcHael josepH soloMon";
my $newname = join ' ', map { ucfirst lc $_ } split ' ' => $name;
>print "$newname\n";
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 19 Jul 2000 09:23:32 +0100
From: "mike solomon" <mike.solomon@eps.ltd.uk>
Subject: Re: upper case first
Message-Id: <8l3ol6$3l6vd$1@ID-36965.news.cis.dfn.de>
Thanks very much for that
I knew there must be a better way to do it
Regards
Mike Solomon
jason <elephant@squirrelgroup.com> wrote in message
news:MPG.13e00244799b543e9896f7@news...
> mike solomon wrote ..
> >I need to convert a name to be lower case but with the first letter as
> >uppercase
> >
> >I have written the following script that works but is very clumsy for a
> >simple operation
> >
> >does anyone know of a better way to do it, I am sure there must be one !
> >
> >
> >#! /usr/local/bin/perl -w
> >use strict;
> >
> >my $name = "mIcHael josepH soloMon";
>
> my $newname = join ' ', map { ucfirst lc $_ } split ' ' => $name;
>
> >print "$newname\n";
>
> --
> jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 19 Jul 2000 08:32:13 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: upper case first
Message-Id: <slrn8napjn.90q.bernard.el-hagin@gdndev25.lido-tech>
mike solomon <mike.solomon@eps.ltd.uk> wrote:
>I need to convert a name to be lower case but with the first letter as
>uppercase
>
>I have written the following script that works but is very clumsy for a
>simple operation
>
>does anyone know of a better way to do it, I am sure there must be one !
How about:
$_ = "mIcHaEl";
s/(\w+)/ucfirst (lc $1)/e;
print;
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 09:47:31 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: upper case first
Message-Id: <MPG.13e0168448db8b5d9896f9@news>
Bernard El-Hagin wrote ..
>mike solomon <mike.solomon@eps.ltd.uk> wrote:
>>I need to convert a name to be lower case but with the first letter as
>>uppercase
>>
>>I have written the following script that works but is very clumsy for a
>>simple operation
>>
>>does anyone know of a better way to do it, I am sure there must be one !
>
>How about:
>
>$_ = "mIcHaEl";
>s/(\w+)/ucfirst (lc $1)/e;
>print;
needs to be global to work for the stated input of "mIcHael josepH
soloMon"
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 19 Jul 2000 10:01:29 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: upper case first
Message-Id: <slrn8naur4.90q.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 19 Jul 2000 09:47:31 GMT, jason <elephant@squirrelgroup.com> wrote:
>Bernard El-Hagin wrote ..
>>mike solomon <mike.solomon@eps.ltd.uk> wrote:
>>>I need to convert a name to be lower case but with the first letter as
>>>uppercase
>>>
>>>I have written the following script that works but is very clumsy for a
>>>simple operation
>>>
>>>does anyone know of a better way to do it, I am sure there must be one !
>>
>>How about:
>>
>>$_ = "mIcHaEl";
>>s/(\w+)/ucfirst (lc $1)/e;
>>print;
>
>needs to be global to work for the stated input of "mIcHael josepH
>soloMon"
You're right, Jason.
$_ = "mIcHael josepH soloMon";
s/(\w+)/ucfirst (lc $1)/eg;
print;
That'll do it.
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 08:04:00 GMT
From: haaaajo@removethis.dds.nl (Chest Rockwell)
Subject: Re: watch out for the mod operator!
Message-Id: <3975604e.1039798234@news.wirehub.nl>
On Tue, 18 Jul 2000 17:47:34 -0400, Stephen Kloder
<stephenk@cc.gatech.edu> wrote:
>W Kemp wrote:
>
>> >Your number may be too large to be corectly handled as an integer in some
>> >perl functions. Try using Math::BigInt:
>>
>> the number is over 2**40 !
>
>I knew that. I said it *may* be too large because on my system (Win98, perl
>5.005_03) I had no trouble using + - * or / on that number, just %. I
>expected BigInt to work correctly on all platforms.
Thanks for the answers, I am currently using this function which seems
to work OK.
sub mymod($,$) {
my ($arg1,$arg2) = @_;
return $arg1 - $arg2 * int($arg1 / $arg2);
}
I find it strange that perl returns an unpredictable answer when it
can't handle the length of an integer. Hard to debug when your code is
long.
Cheers.
Chest
------------------------------
Date: Wed, 19 Jul 2000 08:02:04 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: What does this mean?
Message-Id: <slrn8nanr7.90q.bernard.el-hagin@gdndev25.lido-tech>
Taurean <jaurangNOjaSPAM@crosswinds.net.invalid> wrote:
>Does anybody know what this means?
>
>while (<F>) {
> chomp;
> @pare=split(/=/);
> $pare[0]="property\\"."$pare[0]";
> $headinter{"$pare[0]"}=$pare[1];
>}
Looks like it could be Perl code.
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 10:33:13 +0200
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Re: What does this mean?
Message-Id: <397567C9.12D0AD2B@orga.com>
Taurean wrote:
>
> Does anybody know what this means?
Someone used $_
> while (<F>) {
means: while ($_ = <F>) {
chomp;
means: chomp $_
and so on.
HTH
Ulrich
--
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925
mailto:uackermann@orga.com
------------------------------
Date: Wed, 19 Jul 2000 11:56:58 +0200
From: "Hans Kvalheim" <hansjakv@eunet.no>
Subject: Where on the net can I
Message-Id: <8l3tru$shs$1@oslo-nntp.eunet.no>
find more info about PERL?
H@ns
somewhere in Norway!
------------------------------
Date: Wed, 19 Jul 2000 10:03:38 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Where on the net can I
Message-Id: <slrn8nauv4.90q.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 19 Jul 2000 11:56:58 +0200, Hans Kvalheim <hansjakv@eunet.no> wrote:
>find more info about PERL?
www.python.org
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 09:02:45 GMT
From: Vinod K. Menon <anuragmenon@my-deja.com>
Subject: Re: Yet another string manipulation question -
Message-Id: <8l3qrf$a1t$1@nnrp1.deja.com>
What Jason says is what i was asking..Maybe I should have been a little
more clear...anyway, I am still having problems with the v though..v
should be followed only by a. If ANY other character comes after v then
an X needs to be inserted between them.
vac should become vaXc
whereas vcd should be vXcd
similarly..vce should become vXcXe
.....somehow that one case is kicking me..
In article <MPG.13dfc024536c1c9e9896f2@news>,
elephant@squirrelgroup.com (jason) wrote:
> Keith Calvert Ivey wrote ..
> >elephant@squirrelgroup.com (jason) wrote:
> >
> >>change your code to this for flawless operation (thanks to Keith)
> >>
> >> my %rules = ( a => 'be', c => 'd', e => 'kl', v => 'a' );
> >> my $char = 'X';
> >>
> >> for my $key (keys %rules)
> >> {
> >> $String1 =~ s/$key(?=[^$rules{$key}])/$key$char/g;
> >> }
> >
> >Actually, there's one more problem. What about the end of the
> >string? I assume 'acdea' should become 'aXcdeXaX', but this
> >code gives 'aXcdeXa'. Change the substitution to use a negative
> >look-ahead:
> >
> > $String1 =~ s/$key(?![$rules{$key}])/$key$char/g;
>
> nup .. the original spec gave an example of one of those .. and no X
was
> added when it ended the string .. this was actually the reason why I
> abandoned the lookahead in the first place .. I was negative-looking
at
> first and realised that it added to the end of the string - so I went
> for the negative character class and straight capturing
>
> here's Vinod's words ..
> >and if the input string is aece, the string should be made aeXcXe
>
> --
> jason -- elephant@squirrelgroup.com --
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 09:30:37 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Yet another string manipulation question -
Message-Id: <slrn8nat18.90q.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 19 Jul 2000 09:02:45 GMT, Vinod K. Menon
<anuragmenon@my-deja.com> wrote:
>What Jason says is what i was asking..Maybe I should have been a little
>more clear...anyway, I am still having problems with the v though..v
>should be followed only by a. If ANY other character comes after v then
>an X needs to be inserted between them.
>
>vac should become vaXc
>whereas vcd should be vXcd
>similarly..vce should become vXcXe
>
>.....somehow that one case is kicking me..
Try this:
__________________
#!/usr/bin/perl -w
use strict;
while (<DATA>){
s/(va|v(?!a)|.)/$1X/g;
print;
}
__DATA__
vac
vcd
vcevahhh
vavavava
__________________
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 09:36:43 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Yet another string manipulation question -
Message-Id: <MPG.13e0140367011fa19896f8@news>
Vinod K. Menon wrote ..
>In article <MPG.13dfc024536c1c9e9896f2@news>,
>elephant@squirrelgroup.com (jason) wrote:
-
>>>>change your code to this for flawless operation (thanks to Keith)
>>>>
>>>> my %rules = ( a => 'be', c => 'd', e => 'kl', v => 'a' );
>>>> my $char = 'X';
>>>>
>>>> for my $key (keys %rules)
>>>> {
>>>> $String1 =~ s/$key(?=[^$rules{$key}])/$key$char/g;
>>>> }
-
>
>vac should become vaXc
>whereas vcd should be vXcd
>similarly..vce should become vXcXe
>
>.....somehow that one case is kicking me..
[ please post your reply below the text that you're quoting ]
I'm getting exactly that output with the above three inputs from the
adjusted code as per above
vac produces vaXc
vcd produces vXcd
vce produces vXcXe
copy and paste the above code (all of it - including the hash
initialisation) and it will work
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3744
**************************************