[19349] in Perl-Users-Digest
Perl-Users Digest, Issue: 1544 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 16 21:05:31 2001
Date: Thu, 16 Aug 2001 18:05:12 -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: <998010311-v10-i1544@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 16 Aug 2001 Volume: 10 Number: 1544
Today's topics:
Re: Alphabetized list of perldoc documentation?? (Abigail)
Re: Alphabetized list of perldoc documentation?? <miscellaneousemail@yahoo.com>
ANNOUNCE: MIME::Lite 2.115 uploaded to CPAN (Eryq)
ANNOUNCE: Win32::ActAcc 1.0 (Phill Wolf)
Re: Any way of detecting running in eval? (Martien Verbruggen)
Re: Any way of detecting running in eval? (Abigail)
Call for Bids - C/Perl bridge using XSUBS (Allen C)
Re: comment deletion problem (Tad McClellan)
Re: encrypting passwords (Abigail)
Re: Evaluation order of object methods <djberg96@hotmail.com>
Re: Exporting all files to a scalar/array <cberry@cinenet.net>
FAQ: How do I do a "tail -f" in perl? <faq@denver.pm.org>
Re: Help! Multiple line extract from file based on use <joe+usenet@sunstarsys.com>
Re: Help! Multiple line extract from file based on use <krahnj@acm.org>
local exec via cgi <ds@ss.com>
Modifying single-characters <removespamjeremyalansmith@netscapeonline.co.uk>
Re: Modifying single-characters <wyzelli@yahoo.com>
Re: Modifying single-characters (Eric Bohlman)
Re: Modifying single-characters <bart.lateur@skynet.be>
Re: Newbie Perl Installation - "%1 is not a valid Windo <ash@turnernewmedia.com.au>
Re: Parameter asserts?? (Abigail)
Re: Passing single reference into a sub assigning @_ in <miscellaneousemail@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Aug 2001 22:23:06 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Alphabetized list of perldoc documentation??
Message-Id: <slrn9nohut.ksf.abigail@alexandra.xs4all.nl>
Carlos C. Gonzalez (miscellaneousemail@yahoo.com) wrote on MMCMVI
September MCMXCIII in <URL:news:MPG.15e47022402cdc5c989758@news.edmonton.telusplanet.net>:
`' In article <slrn9nleu2.5k4.trammell@haqq.hypersloth.net>, John J.
`' Trammell at trammell@haqq.hypersloth.invalid says...
`'
`' > Here's a short, easy-to-remember command:
`' >
`' > % man perl | col -bx | grep '^ *perl' | grep Perl | sort
`' >
`'
`' Thanks again John.
`'
`' Normally when I see a line like that I just run =:) the other way. Boy
`' oh boy has Windows spoiled me or what? I don't have to think or remember
`' much on Windows compared to you Unix folks.
Yeah, that explains why you ask so many questions about things that
are non-issues in the Unix world.
You aren't spoiled. You are dummified.
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: Thu, 16 Aug 2001 22:56:08 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: Alphabetized list of perldoc documentation??
Message-Id: <MPG.15e5fd1f1ab9f76298976d@news.edmonton.telusplanet.net>
In article <slrn9nohut.ksf.abigail@alexandra.xs4all.nl>, Abigail at
abigail@foad.org says...
> Yeah, that explains why you ask so many questions about things that
> are non-issues in the Unix world.
Weelll.... I don't know if I agree with that Abigail. Most of my
questions are about Perl, perl syntax, use, and coding. I would think
these things would be just as much of an issue to Perl newbies on Unix
as they are to a Perl newbie on Windows. Perhaps not as much but surely
they would still be an issue? I mean are you telling me that all Unix
users start out as experts?
> You aren't spoiled. You are dummified.
Well.... I don't know about this one either Abigail. To be spoiled is to
have everything given to you on a silver platter. To be spoiled is to
have everything done for you. On the other hand to be dummified is to be
so crippled mentally as to be incapable of learning how to do anything
for yourself. At least as I understand the words.
I didn't start out on Unix Abigail, I didn't cut my programming teeth on
Unix. Does that make me dummified? I disagree with you here Abigail.
As far as I am concerned we are all just programmers doing what we love
to do. Some do it on Unix. Some on Windows. If I have grown up
programming on Windows Abigail that doesn't make me a dummy anymore than
you growing up on Unix makes you a snob (something that a lot of folks
look on Unix folks as being).
Thanks.
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
Date: 16 Aug 2001 08:29:36 -0700
From: eryq@zeegee.com (Eryq)
Subject: ANNOUNCE: MIME::Lite 2.115 uploaded to CPAN
Message-Id: <tnoqh4ni1ihv6d@corp.supernews.com>
Prepare/send messages with attachments, using pure Perl.
Latest version has a few new features/improvements, and
the HTML docs are better. For details, visit:
http://www.zeegee.com/code/perl/MIME-Lite/
http://www.zeegee.com/code/perl/MIME-Lite/docs
Enjoy.
------------------------------
Date: 15 Aug 2001 19:20:22 -0700
From: pbwolf@cpan.org (Phill Wolf)
Subject: ANNOUNCE: Win32::ActAcc 1.0
Message-Id: <tnoqgjbjci7q65@corp.supernews.com>
With Win32::ActAcc (Active Accessibility client), Perl scripts can -
* find "accessible objects" on the screen (e.g., buttons)
* query accessible objects as to their contents or state
* listen for WinEvents consequent to a user's gesture
* press buttons, expand outlines, etc. via Active Accessibility
1001 potential uses, such as:
- Automate usage of a certain annoying source-control GUI.
- Un-minimize emails containing the word "aardvark".
- Answer incoming IM's by running them through Chatbot::Eliza.
People who like to use the right tool for the job will augment Active
Accessibility with the Win32 API, via Win32::GuiTest.
Win32::ActAcc 1.0 is on CPAN. gz for PPM/ActivePerl included.
What's new: iterators, polymorphic/OO access to menus and outlines,
etc., etc. Also, a fix for the bug in version 0.5.
------------------------------
Date: Fri, 17 Aug 2001 08:10:53 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Any way of detecting running in eval?
Message-Id: <slrn9noh7d.3ga.mgjv@martien.heliotrope.home>
On Thu, 16 Aug 2001 03:13:49 -0400 (EDT),
lapplisa-no-spam@cotse.com <lapplisa-no-spam@cotse.com> wrote:
> OK, gentlepeople, I see I really didn't phrase that well.
> My bad. Let's try another tack.
>
> What I _really_ meant to ask was if there was a way to detect
> running in _nested_ evals. Look at this program:
>
> --------------
> #!/usr/bin/perl -w
>
> use strict;
> require 5;
>
> my $lev2="print \"[\",caller,\"]\n\";";
> my $lev1="print \"[\",caller,\"]\n\"; eval $lev2";
my $lev1="print \"[\",caller,\"]\n\"; eval \$lev2";
> eval $lev1;
> print "[",caller,"]\n";
And to make it more clear:
my $lev4="print \"[\",caller,\"]\n\";";
my $lev3="print \"[\",caller,\"]\n\"; eval \$lev4";
my $lev2="print \"[\",caller,\"]\n\"; eval \$lev3";
my $lev1="print \"[\",caller,\"]\n\"; eval \$lev2";
eval $lev1;
outputs
[main/tmp/foo.pl10]
[main(eval 1)2]
[main(eval 2)2]
[main(eval 3)2]
Also, you can call caller() with an argument that specifies how far up
the callstack you want to look. You could simply keep looking higher up
the callstack as long as you see that you're in an eval (check for
$evaltext being true, for example, see perlfunc). The number of times
you need to do that would tell you how deep your eval nesting is.
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd. | no excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: 16 Aug 2001 23:53:52 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Any way of detecting running in eval?
Message-Id: <slrn9non94.ksf.abigail@alexandra.xs4all.nl>
lapplisa-no-spam@cotse.com (lapplisa-no-spam@cotse.com) wrote on MMCMVII
September MCMXCIII in <URL:news:bGFwcGxpc2E=.62493bf3332e7aec70b1b14de2873a62@997946029.cotse.com>:
{}
{} So I don't see no way to distinguish beween the first
{} and the second level eval. Is there?
perldoc -f caller
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: 16 Aug 2001 17:03:54 -0700
From: perl_systems@onebox.com (Allen C)
Subject: Call for Bids - C/Perl bridge using XSUBS
Message-Id: <a271d2a4.0108161603.1ed6dcce@posting.google.com>
We are currently seeking contractors/programmers with C/Perl/XSUBS/DBI
experience who can quickly build a Perl wrapper for a C API. (The DBI
experience is optional.) The platform is Linux.
The API consists of approximately 50 functions and will require the
passage from C to Perl of about 2-4 compound data structures of
non-trivial complexity.
For a contractor/programmer with prior experience in this area, we
anticipate that this should be a relatively small project, which can
be completed in short order.
If you are interested, please contact me at this email address
(perl_systems@onebox.com) with an overview of your qualifications and
an approximate estimate of the cost of the project (lower bound and
upper bound, given the incomplete description presented here). If we
believe there may be a good match, we will contact you to provide
further details about the project.
------------------------------
Date: Thu, 16 Aug 2001 17:48:21 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: comment deletion problem
Message-Id: <slrn9noft5.6ak.tadmc@tadmc26.august.net>
B Puli <bpuli@hotmail.com> wrote:
>how can i separate these two comments using a regexp? or any other
>way?
Just like the FAQ says. Even the not-so-good first alternative
works with your data.
>all the standard c-comment deletion regexps i found (in the perl docs)
>and those suggested by folks on this group are combining the above two
>comments into one.
Treats them separately as far as I can tell. Got any code that
shows them being treated as one?
I have code that shows them separated:
--------------------------------------------
#!/usr/bin/perl -w
use strict;
$_ =<<'ENDC';
/*********************************************************************
* <pre>
* header information
* </pre>
**********************************************************************
*
* @filename bp.c
*
* @purpose
*
* @component
*
* @comments none
*
* @create 08/15/2001
*
* @author bp
* @end
*
**********************************************************************/
/**************************@null{*************************************
Change History
*******************************}*************************************}
$Log: bp.c $
Revision 1.1.1.7 2001/07/02 14:52:29EDT bp
Revision 1.1.1.6 2001/06/29 19:32:53EDT bp
Revision 1.1.1.5 2001/06/28 19:13:25EDT bp
Revision 1.1.1.4 2001/06/28 19:11:25EDT bp
Revision 1.1.1.3 2001/06/28 19:10:01EDT bp
Revision 1.1.1.2 2001/06/27 19:50:00EDT bp
Revision 1.1.1.1 2001/06/14 18:17:07EDT bp
Initial revision
**********************************************************************/
ENDC
while ( m{(/\*.*?\*/)}gs ) {
print "$1\n--------------\n\n";
}
--------------------------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Aug 2001 23:58:51 GMT
From: abigail@foad.org (Abigail)
Subject: Re: encrypting passwords
Message-Id: <slrn9nonie.ksf.abigail@alexandra.xs4all.nl>
AJ (jerseycat10@yahoo.com) wrote on MMCMVI September MCMXCIII in
<URL:news:7eddc058.0108151328.29ac8787@posting.google.com>:
|| Hello, right now, I have a perl logon/logoff system on my site.
|| However, all the data files I use (.passwd, .email, etc), are set with
|| lax security permissions to satisfy perl. I am wondering if there are
|| any encryption techniques widely available to combat this problem.
No. And that has nothing to do with Perl but with encryption in
general. If your decryption algorithm is known (and it is in your case,
it's your Perl source), the one and only thing that keeps your data secret
is the key. And from your question, I sense that having a person supply
the key in one way or the other (type it in, certificate, smart card)
isn't an option. Which would mean your Perl program needs to be able to
read the key from some resource, like a file. And that file cannot be
encrypted. But then, there's no additional security in encrypting the
data files if the key still can be gotten as easily.
Abigail
--
#!/opt/perl/bin/perl -- # Remove trailing newline!
BEGIN{$SIG{__WARN__}=sub{$_=pop;y-_- -;print/".*(.)"/;
truncate$0,-1+-s$0;exec$0;}}//rekcaH_lreP_rehtona_tsuJ
------------------------------
Date: Thu, 16 Aug 2001 22:37:42 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: Evaluation order of object methods
Message-Id: <WWXe7.575$Cf5.41106@typhoon.mn.mediaone.net>
"Abigail" <abigail@foad.org> wrote in message
news:slrn9noe62.ksf.abigail@alexandra.xs4all.nl...
> || if(wantmethod){ # return blessed copy of self }
>
> A blessed copy of *self*? That doesn't make much sense for a length()
> method, does it?
Ok - "a blessed reference to a copy of the global array that's part of the
object". I was being lazy.
>
> || elsif(defined wantarray){ # return a scalar or list }
> || else{ # return self }
> ||
> || Is this possible?
>
>
> Sort of. What you need to do is have every method return an object with
> appropriate stringification and/or numerification overloading.
>
> There's no listification overloading though. But there's @{} overloading.
Hmm...ok - I'll look into that. Thanks.
------------------------------
Date: Thu, 16 Aug 2001 22:40:14 -0000
From: Craig Berry <cberry@cinenet.net>
Subject: Re: Exporting all files to a scalar/array
Message-Id: <Xns90FF9F68D75F1cberrycinenetnet1@207.126.101.92>
Joe Schaefer <joe+usenet@sunstarsys.com> wrote in
news:m366bn4svq.fsf@mumonkan.sunstarsys.com:
> I agree the split is unnecessary, but I don't think there's a
> zero-length string at the end of the resulting list.
You're right, of course; I was remembering a related but distinct case.
--
Craig Berry <http://www.cinenet.net/~cberry/>
"That which is now known, was once only imagined." - William Blake
------------------------------
Date: Fri, 17 Aug 2001 00:17:01 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I do a "tail -f" in perl?
Message-Id: <1oZe7.184$V3.171041792@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How do I do a "tail -f" in perl?
First try
seek(GWFILE, 0, 1);
The statement "seek(GWFILE, 0, 1)" doesn't change the current position,
but it does clear the end-of-file condition on the handle, so that the
next <GWFILE> makes Perl try again to read something.
If that doesn't work (it relies on features of your stdio
implementation), then you need something more like this:
for (;;) {
for ($curpos = tell(GWFILE); <GWFILE>; $curpos = tell(GWFILE)) {
# search for some stuff and put it into files
}
# sleep for a while
seek(GWFILE, $curpos, 0); # seek to where we had been
}
If this still doesn't work, look into the POSIX module. POSIX defines
the clearerr() method, which can remove the end of file condition on a
filehandle. The method: read until end of file, clearerr(), read some
more. Lather, rinse, repeat.
There's also a File::Tail module from CPAN.
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
05.28
--
This space intentionally left blank
------------------------------
Date: 16 Aug 2001 18:12:59 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Help! Multiple line extract from file based on user input.
Message-Id: <m31ymb4psk.fsf@mumonkan.sunstarsys.com>
tadmc@augustmail.com (Tad McClellan) writes:
> Lyle <lbeckm3@hotmail.com> wrote:
> >I am trying to write a perl script that will extract the given lines
> >from a file based on a list the user types in, i.e.
> >
> >Records to print: 2,15,34-60,87
> >
> >Is it possible to do this without iterating through the file multiple
> >times for each number or range?
>
>
> Yes, if the whole file will fit into memory.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If that's not the case, here's another way:
#!/usr/bin/perl -wT
use strict;
my $input = '2,34-60,15'; # detaint if taken from user input !!!
my @range = map {s/-/../ or $_ .= "..$_"; "scalar($_)"}
split /,/, $input;
$"=",";
my $matched_ranges = eval << "CODE";
sub {
my \@match = (@range);
grep \$match[\$_] => (0..$#range);
}
CODE
die $@ if $@; # eval failed?
my @lolines; # ordered LoL of matched lines
while (<>) {
foreach my $ary ( @lolines[$matched_ranges->()] ) {
push @$ary, $_;
}
}
print @$_ foreach @lolines; # print lines in correct order
__END__
The basic idea here is to turn 2,34-60,15 into an array
of line number tests:
@range = ( scalar(2..2), scalar(34..60), scalar(15..15) );
While reading through the file (one time), $matched_ranges->()
then returns a list of successful indices from this list.
HTH
--
Joe Schaefer "I must have a prodigious quantity of mind; it takes me as much
as a week sometimes to make it up."
--Mark Twain
------------------------------
Date: Thu, 16 Aug 2001 22:19:15 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Help! Multiple line extract from file based on user input.
Message-Id: <3B7C474E.845CF25A@acm.org>
Lyle wrote:
>
> I am trying to write a perl script that will extract the given lines
> from a file based on a list the user types in, i.e.
>
> Records to print: 2,15,34-60,87
>
> Is it possible to do this without iterating through the file multiple
> times for each number or range? I could see doing this in a sorted
> array but my brain can't get past the "how do I handle the ranges"
> such as the 34-60 listed above? Also the order that the operator
> selects must remain the same, i.e. if the operator puts
>
> ..print: 3,7,4,26
>
> The file must be in that order in the end. TIA!!
perl -le'$_="2,15,34-60,87";s/-/../g;print;@x=();eval"\@x = ($_)";print
"@x"'
2,15,34..60,87
2 15 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
56 57 58 59 60 87
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 16 Aug 2001 23:13:04 GMT
From: GunneR <ds@ss.com>
Subject: local exec via cgi
Message-Id: <129rntscc67ecs5cm8hehf82cpet5618fi@4ax.com>
I know this is very insecure, and im not sure if its even perl
related, but...
Im trying to write a cgi script that executes local code (via system,
exec, etc) on the system that visits the page.
My alternative is to use socket (server, client) stuff to talk back
and fourth (Linux, Windows) but that could get messy. Is there some
funky module that does this or do I have to write some real shoddy cgi
code? TIA!
------------------------------
Date: Fri, 17 Aug 2001 00:32:12 +0100
From: "Jeremy Smith" <removespamjeremyalansmith@netscapeonline.co.uk>
Subject: Modifying single-characters
Message-Id: <hHYe7.3336$0c2.904481@news2-win.server.ntlworld.com>
Hi again!
I found out how to modify a single character so I could add to it. I found
the 2 functions chr and ord.
So to turn an 'A' into a 'B' I have done:
$oldchar=ord('A');
$addchar=$oldchar+1;
$newchar=chr($addchar);
This means that no-one has to help me out on this thread.
Cheers,
Jeremy.
------------------------------
Date: Fri, 17 Aug 2001 09:26:55 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Modifying single-characters
Message-Id: <20Ze7.62$wg1.164497@wa.nnrp.telstra.net>
"Jeremy Smith" <removespamjeremyalansmith@netscapeonline.co.uk> wrote in
message news:hHYe7.3336$0c2.904481@news2-win.server.ntlworld.com...
> Hi again!
>
> I found out how to modify a single character so I could add to it. I found
> the 2 functions chr and ord.
>
> So to turn an 'A' into a 'B' I have done:
>
> $oldchar=ord('A');
> $addchar=$oldchar+1;
> $newchar=chr($addchar);
>
> This means that no-one has to help me out on this thread.
But you could learn about some of the magical properties of autoincrement.
$oldchar = 'A';
$newchar = ++$oldchar;
From perlop:
``++'' and ``--'' work as in C. That is, if placed before a variable, they
increment or decrement the variable before returning the value, and if
placed after, increment or decrement the variable after returning the value.
The auto-increment operator has a little extra builtin magic to it. If you
increment a variable that is numeric, or that has ever been used in a
numeric context, you get a normal increment. If, however, the variable has
been used in only string contexts since it was set, and has a value that is
not the empty string and matches the pattern /^[a-zA-Z]*[0-9]*\z/, the
increment is done as a string, preserving each character within its range,
with carry:
print ++($foo = '99'); # prints '100'
print ++($foo = 'a0'); # prints 'a1'
print ++($foo = 'Az'); # prints 'Ba'
print ++($foo = 'zz'); # prints 'aaa'
The auto-decrement operator is not magical
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: 17 Aug 2001 00:11:02 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Modifying single-characters
Message-Id: <9lhnem$7ge$1@bob.news.rcn.net>
Wyzelli <wyzelli@yahoo.com> wrote:
> From perlop:
> ``++'' and ``--'' work as in C. That is, if placed before a variable, they
> increment or decrement the variable before returning the value, and if
> placed after, increment or decrement the variable after returning the value.
> The auto-increment operator has a little extra builtin magic to it. If you
> increment a variable that is numeric, or that has ever been used in a
> numeric context, you get a normal increment. If, however, the variable has
> been used in only string contexts since it was set, and has a value that is
> not the empty string and matches the pattern /^[a-zA-Z]*[0-9]*\z/, the
> increment is done as a string, preserving each character within its range,
> with carry:
> print ++($foo = '99'); # prints '100'
> print ++($foo = 'a0'); # prints 'a1'
> print ++($foo = 'Az'); # prints 'Ba'
> print ++($foo = 'zz'); # prints 'aaa'
> The auto-decrement operator is not magical
The one thing you have to watch out for (as was the topic of a recent
thread) is that string incrementation is *not* monotonic under lexical
ordering; as the last example shows, the incremented value of a variable
can be less than the original value, which can lead to some surprises if
the variable is part of a loop conditional.
------------------------------
Date: Fri, 17 Aug 2001 00:32:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Modifying single-characters
Message-Id: <uepontk4ler3lsh89k26jldven820sp22l@4ax.com>
Jeremy Smith wrote:
>So to turn an 'A' into a 'B' I have done:
>
>$oldchar=ord('A');
>$addchar=$oldchar+1;
>$newchar=chr($addchar);
$char = 'A';
vec($char, 0, 8)++;
print $char;
-->
B
vec() is one way to treat a string as an array of (8 bit) integers. So I
increment the first such integer (=a byte) in that string.
Yes, $char++ would work too, in this case. But start with $char='Z' and
you'll notice the difference.
--
Bart.
------------------------------
Date: Fri, 17 Aug 2001 10:09:10 +1000
From: Ash Turner <ash@turnernewmedia.com.au>
Subject: Re: Newbie Perl Installation - "%1 is not a valid Windows NTApplication"
Message-Id: <B7A29DC5.881%ash@turnernewmedia.com.au>
Hi Paul
Thanks, I've double checked all this and still get the same error :(. I am
not a perl programmer, just want to get it running so I can testrun
cgi-scripts before installing on a web server. I am running NT 4.0 Option
pack 6, IIS 4 (current commercial version used on our web hosts). And yes
using ActivePerl.
Your help in getting me through this mess is much appreciated.
Cheers
Ash
in article 997946807.22271.0.nnrp-01.d4f094e4@news.demon.co.uk, Paul
Fortescue at paul@net366.com wrote on 16/8/01 5:28 PM:
>
> "Ash Turner" <ash@turnernewmedia.com.au> wrote in message
> news:B7A1A4B2.6B5%ash@turnernewmedia.com.au...
>> Hi
>>
>> I've just installed perl on my NT Server. I know it's working. When I try
>> and access through my web scripts though I get the error "%1 is not a
> valid
>> Windows NT Application".
>>
>> I think It's the pathname which I've set to "c:/perl/bin/" in my perl
>> scripts, which is the pathname on the NT box.
>>
>> Any help greatly appreciated.
>>
>>
>> Ash Turner
>>
> In your applications extensions for .pl files, you should have:
>
> C:\Perl\bin\Perl.exe %s %s
>
> Presumably it is ActivePerl you're using? Is it for old NT (4.0) or new NT
> (2000)? What v of IIS r u on?
>
> Paul
> $s="Jack runs most fast however, a snoot from Bart brashly accelerates
> further spammongers. Paul sees Martynovs curly hair; has Tad picking tick
> processes rather carefully.";
> $i=0;$1=~m/[,.;]/?($i=0,print" "):print substr($1,$i++,1) while
> $s=~m/(\w+[,.;]?)/g;
>
>
>
>
>
------------------------------
Date: 16 Aug 2001 23:37:13 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Parameter asserts??
Message-Id: <slrn9nom9s.ksf.abigail@alexandra.xs4all.nl>
Carlos C. Gonzalez (miscellaneousemail@yahoo.com) wrote on MMCMIV
September MCMXCIII in <URL:news:MPG.15e11f1e5b1786e3989738@news.edmonton.telusplanet.net>:
== In article <3b77582b@news.victoria.tc.ca>, Malcolm Dew-Jones at
== yf110@vtn1.victoria.tc.ca says...
==
== > Before a program unit does anything you can notice (including taking up
== > time, if possible) it should check that all its input is valid, and refuse
== > to run if the input is not valid.
==
== If that is what parameter asserts are, no problem (at least in terms of
== my using them). I check just about every possible scenario I can think
== of in my most important functions. I first write a basic function and
== get it working. Then I rewrite the function in pseudocode. Working into
== the pseudocode a check for every possible input that I can think of. Then
== I implement the pseudocode and flesh out the function to check for bad
== input. It's a labor intensive work but I have to do this because of the
== nature of my web site. Some of the stuff I will put on it may end up not
== being very popular and I have to make sure that my web site is as secure
== and free from the affects of surprises as I can reasonably make it. Not
== to mention that I don't want any bugs to surprise my subscribers.
That isn't the right way of doing it. Checks shouldn't be put in as an
after thought, nor should you write a check for all inputs you can think
of - you are bound to forget one.
The principle is simple. You want to write a function that takes arguments
X, Y and Z. X, Y and Z satisfy some precondition (for instance, they
all have to be positive, odd integers).
When you write your function, you start by checking the arguments if
they satisfy the precondition. If not, you throw an exception. Else,
you continue with the real work. No need to think about every possible
situation, there are only two that matter: the ones that satisfy the
precondition, and the ones that do not.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
------------------------------
Date: Thu, 16 Aug 2001 22:06:11 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: Passing single reference into a sub assigning @_ into a hash??
Message-Id: <MPG.15e5f1efb34ccf3098976c@news.edmonton.telusplanet.net>
In article <slrn9no7k5.5sq.tadmc@tadmc26.august.net>, Tad McClellan at
tadmc@augustmail.com says...
> Please consider providing some input data. Saying it Perl is more
> precise that natural language anyway:
>
> my %file_hash = (
> 'jack@ardvark.com' => 'Jack,20010812,18:34,Canada,Stony Plain,Yes',
> 'linda@ant.com' => 'Linda,20010812,18:34,France,Paris,Yes',
> );
>
>
> That wouldn't have been very hard.
Will do Tad. Thanks.
---
Carlos
www.internetsuccess.ca
*NOTE*: Internet Success is NOT yet fully operational so although you are
welcomed to visit and take a look, trying to subscribe will only be a
frustration for you as your data will not be saved at this time.
------------------------------
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 1544
***************************************