[6685] in Perl-Users-Digest
Perl-Users Digest, Issue: 310 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 15 22:17:17 1997
Date: Tue, 15 Apr 97 19:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 15 Apr 1997 Volume: 8 Number: 310
Today's topics:
Re: "Dummies" book any good? <tchrist@mox.perl.com>
Re: "Dummies" book any good? <jvenu@ctp.com>
"my" variable affects namespace "outside" block? (John F. Whitehead)
"Page Jump" script for frames? <harperm1@execpc.com>
Re: [Q] How to capitilize beginning of words (Brian Lavender)
Re: [Q] How to capitilize beginning of words <tchrist@mox.perl.com>
Re: [Q] How to capitilize beginning of words (brian d foy)
Re: how to use a system-installed Perl w/locally downlo (Nathan V. Patwardhan)
Re: Ousterhout and Tcl lost the plot with latest paper lvirden@cas.org
Re: Ousterhout and Tcl lost the plot with latest paper <gjc@delphi.com>
Re: Perl and MSDOS (Petr Prikryl)
Re: Perl parsing (A. Deckers)
Re: Perl parsing <tchrist@mox.perl.com>
Re: Perl regular expressions - HTML (Tad McClellan)
Re: Perl-Books. lvirden@cas.org
Re: Q: Uniq'ing a list <tchrist@mox.perl.com>
Re: question: How does one substitute into something ot <dbenhur@egames.com>
Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Henry Baker)
slices in scalar context - bug or feature? (Jim Robinson)
Re: Unix and ease of use (WAS: Who makes more ...) <tim@a-sis.com>
Re: Unix and ease of use (WAS: Who makes more ...) <urban@unix.mauigateway.com>
Re: Why doesn't until(<FILE> =~ /^\D/) { work? (David Alan Black)
Re: Why is $Line=~ s///; erasing = (Brand Hilton)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Apr 1997 00:01:05 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: "Dummies" book any good?
Message-Id: <5j14s1$9u7$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Terry Michaels <74331.3261@CompuServe.COM> writes:
:I found the first edition of Programming Perl too difficult
:for a beginner in Perl.
Have you looked at the second edition?
Nonetheless, attempting to learn Perl from its reference
work may be similar to learning English with only a dictionary.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Finally, which rhymes with enough --
Though, through, plough, or dough, or cough?
------------------------------
Date: Tue, 15 Apr 1997 20:14:07 -0400
From: "Jagadeesh K. Venugopal" <jvenu@ctp.com>
Subject: Re: "Dummies" book any good?
Message-Id: <335419CF.631D@ctp.com>
Tom Christiansen wrote:
> In comp.lang.perl.misc,
> Terry Michaels <74331.3261@CompuServe.COM> writes:
> :I found the first edition of Programming Perl too difficult
> :for a beginner in Perl.
> Have you looked at the second edition?
> Nonetheless, attempting to learn Perl from its reference
> work may be similar to learning English with only a dictionary.
Absolutely; The book becomes a lot more valuable when you have worked
with Perl for a while. It is invaluable as a reference.
Now if only they took out the excellent modules chapter (Chap. 7) and
made it a full-fledged book with more modules, that would be a real
treat. While most of the module documentation is very good, there is
still something to be said for a nice book.
--
______________________________________________________________________
Jagadeesh K. Venugopal
Cambridge Technology Partners, 304 Vassar Street Cambridge, MA 02139
Phone: 617.374.2028; Fax: 617.374.8300; E-mail: jvenu@ctp.com
______________________________________________________________________
------------------------------
Date: 15 Apr 1997 20:49:38 -0400
From: jfw@wral-tv.wral-tv.com (John F. Whitehead)
Subject: "my" variable affects namespace "outside" block?
Message-Id: <x7afmzkd0d.fsf@wral-tv.wral-tv.com>
Could someone please explain the following to me? (nicely?)
Why does the following program, which uses a "my" variable in a loop,
not get confined to the block it's in, and instead affect the variable the
next time it's used? Example:
---------------------------------------------------------------------------
#!/usr/local/bin/perl5 -w
@filenames = qw(one two/ three four/);
foreach $file (@filenames) {
$ends_in_slash = 0;
($file =~ m#/$#) ? ($ends_in_slash = 1)
: ($ends_in_slash = 0);
print "1 file is `$file'\n";
if ($ends_in_slash == 1) { # this is line 14
print "2 file is `$file'\n";
my $file = "new value";
} else {
print "3 file is `$file'\n";
}
}
---------------------------------------------------------------------------
gives the following output:
---------------------------------------------------------------------------
1 file is `one'
Use of uninitialized value at weird.pl line 14.
3 file is `'
1 file is `two/'
2 file is `two/'
1 file is `three'
Use of uninitialized value at weird.pl line 14.
3 file is `'
1 file is `four/'
2 file is `four/'
---------------------------------------------------------------------------
If you remove the word "my", everything works properly, i.e., the output
is:
---------------------------------------------------------------------------
1 file is `one'
3 file is `one'
1 file is `two/'
2 file is `two/'
1 file is `three'
3 file is `three'
1 file is `four/'
2 file is `four/'
---------------------------------------------------------------------------
My questions are:
1) why does the variable $file get undefined, when it should either
2) why is the effect of the "my" not limited to the if block? or at the
very least, limited to that time through the foreach loop?
3) why do I get an "uninitialized value at line 14", when that variable is
very clearly initialized?
It seems like after the "my", and while exiting the block, $file is
undefined instead of returned to its original value. I thought my was
limited in scope to its block and any blocks it encloses, but not to those
that enclose it.
Thanks for any comments...
- jfw
--
John F. Whitehead
(formerly of WRAL OnLine)
New address: jfw@well.com
------------------------------
Date: Tue, 15 Apr 1997 18:58:23 -0500
From: Mike Harper <harperm1@execpc.com>
Subject: "Page Jump" script for frames?
Message-Id: <3354161F.35B1@execpc.com>
I am looking for a script that will let a user pick an
option from a drop-down box in one frame, click on the
submit button and have a new page, corresponding to
the selection in the edit box, appear in another frame.
Can Perl do this, or do I need to try something like
JavaScript?
Any help would be greatly appreciated!!
-Mike
------------------------------
Date: Wed, 16 Apr 1997 00:06:10 GMT
From: brian@brie.com (Brian Lavender)
Subject: Re: [Q] How to capitilize beginning of words
Message-Id: <33541620.5148315@nntp.netcruiser>
On 15 Apr 1997 16:59:59 GMT, Tom Christiansen <tchrist@mox.perl.com>
wrote:
>You have asked a question or talked about an issue that's specifically
>addressed in the Perl Frequently Asked Questions list.
>
> http://www.perl.com/perl/faq/
>
>Here's just the list of questions:
>
>--> How do I capitalize all the words on one line? <=== This is a hypertext link in the faq
I followed Tom's advice regarding your answer to this question and I
have to say my search led me nowhere. When you click on this question
it leads you to
http://www.perl.org/CPAN/doc/manual/html/pod/
at the top of the page.
Needless to say I could keep on reading, but the answer seems quite
buried making this faq rather useless. It would be nice to see a
simple code example.
Brian
----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley http://www.brie.com/bbd
(707) 226-8891
"The world is a good place if you are in a good position."
------------------------------
Date: 16 Apr 1997 00:38:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: [Q] How to capitilize beginning of words
Message-Id: <5j172o$ae1$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email; a
courtesy that his broken newsreader screwed-up, giving me an
annoying stealth cc. EVIL.]
In comp.lang.perl.misc, brian@brie.com (Brian Lavender) writes:
:On 15 Apr 1997 16:59:59 GMT, Tom Christiansen <tchrist@mox.perl.com>
:wrote:
:
:>You have asked a question or talked about an issue that's specifically
:>addressed in the Perl Frequently Asked Questions list.
:>
:> http://www.perl.com/perl/faq/
:>
:>Here's just the list of questions:
:>
:>--> How do I capitalize all the words on one line? <=== This is a hypertext link in the faq
:
:I followed Tom's advice regarding your answer to this question and I
:have to say my search led me nowhere. When you click on this question
:it leads you to
:
:http://www.perl.org/CPAN/doc/manual/html/pod/
:
:at the top of the page.
:
:Needless to say I could keep on reading, but the answer seems quite
:buried making this faq rather useless. It would be nice to see a
:simple code example.
As I said privately before I realized that you sent me an idiotic
slealth cc, please take a little initiative and don't expect that
the net owes you something. It won't help you any if we just tell
the answer every time. Did you read the perlre manpage? What
about the perlop manpage? Did you read chapter 2 of the camel,
which is full of examples? Why didn't you pursue your search
further when it was right before, but instead send me a stealth
cc and post to the net delaying your gratification and answer
unnumbered hours, and wasting bandwidth to boot.
Start at
http://www.perl.org/CPAN/doc/manual/html/pod/perlfaq.html
and figure it out. I'm really tired of doing everyone else's
homework for them. Why do you think I wrote the FAQ, just
so you don't have to read it?
Wrong.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Many folks want nothing more than to live and let learn." --Larry Wall
------------------------------
Date: Tue, 15 Apr 1997 20:57:44 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: [Q] How to capitilize beginning of words
Message-Id: <comdog-1504972057440001@nntp.netcruiser>
In article <33541620.5148315@nntp.netcruiser>, brian@brie.com (Brian
Lavender) wrote:
> I followed Tom's advice regarding your answer to this question and I
> have to say my search led me nowhere. When you click on this question
> it leads you to
>
> http://www.perl.org/CPAN/doc/manual/html/pod/
>
> at the top of the page.
>
> Needless to say I could keep on reading, but the answer seems quite
> buried making this faq rather useless. It would be nice to see a
> simple code example.
well, you could have taken the short path by choosing the perlfaq
link [1], then the "Data Manipulation" link [2], then the
"How do I capitalize all the words on one line?" link [3], which then
tells you:
To make the first letter of each word upper case:
$line =~ s/\b(\w)/\U$1/g;
which seems rather odd considering that it has other effects...
#!/usr/bin/perl -w
my $string = "i don't like to do my homework";
$string =~ s/\b(\w)/\U$1/g;
print $string;
__END__
I Don'T Like To Do My Homework
^^ hmmmm...
[1]
<URL:http://www.perl.org/CPAN/doc/manual/html/pod/perlfaq.html>
[2]
<URL:http://www.perl.org/CPAN/doc/manual/html/pod/perlfaq4.html>
[3]
<URL:http://www.perl.org/CPAN/doc/manual/html/pod/perlfaq4/
How_do_I_capitalize_al_the_word.html>
--
brian d foy <URL:http://computerdog.com>
unsolicited commercial email is not appreciated
------------------------------
Date: 16 Apr 1997 01:08:09 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: how to use a system-installed Perl w/locally downloaded modules
Message-Id: <5j18pp$i04@fridge-nf0.shore.net>
Terrence M. Brannon (brannon@bufo.usc.edu) wrote:
: I am not superuser, yet I wish to use the system-installed Perl with
: modules I get from CPAN and store in my lcal directory? Is there some
: way to set this up?
Read the INSTALL/README files that came with your distribution... you
might see a reference to prefix, or exec-prefix, or even "install the
modules in another place". OR, run perl Makefile.PL and add the PREFIX
(the base location where you want the modules installed) by hand.
After you've run make install, you can use the modules with:
use lib "/whatever/path"; (This should be documented in the FAQ).
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 15 Apr 1997 23:28:14 GMT
From: lvirden@cas.org
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <5j12ue$9ib@srv13s4.cas.org>
According to Alexey Goldin <a-l-e-x-e-y@o-d-d-j-o-b.u-c-h-i-c-a-g-o.e-d-u>:
:> Anyone who wanted a simple scripting language that could be easily embedded
:> into their applications. Last time I checked Tcl was the only language you
:Have you tried SIOD? CLISP?
I know that I've not tried either of these. In fact, I've never
seen an app that embedded either of these. however, I've seen
several hundred that embedded Tcl - including the latest version of
nvi. Since I prefer to use apps that share the same embedded language
when possible, use of tcl works for me at this time.
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: 16 Apr 1997 01:24:12 GMT
From: "George J. Carrette" <gjc@delphi.com>
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <01bc45a2$98f8ec40$0f02000a@gjchome.nis.newscorp.com>
John Ousterhout <ouster@tcl.eng.sun.com> wrote in article
<5i7euq$cmg@engnews2.Eng.Sun.COM>...
> Wow, there's been quite a party going on over here on comp.lang.scheme!
There is always a party here. But I think the major reason your paper
struck a nerve
has nothing to do with "languages being left out" per se, but everything to
do
with the fact that lisp people do not beleive in your fundamental
assumption
that there is a difference between "scripting" and "system programming"
languages.
In LISP there is a tradition, nearly 40 years old now, of a mixture of
interpreted, compiled, and mixed mode environments. Issues not unique to
LISP
of course, Reference for example Gordon Bell's classic book "Computer
Engineering,
a DIGITAL Perspective." But still, for some reason new lisp programmers
seem to
pick up on this more than newbees using other languages. Eventually of
course
everybody seems to crank out the need to write a compiler. Witness what is
happening
in the Perl community now.
However, I am one that beleives that the language battle is over.
There have been a number of operating systems which emphasize
language-independant "binary interface" component integration to
a sufficiently developed degree that multi-language projects are practical
and robust; however, Microsoft Windows 95/NT seems to have reached
a significant "breakthrough" level in a way that VMS or AS-400 did not.
Primarily because the developer community itself has been sold, kicking and
screaming!
dragged, pushed, whatever, on the component-integration religion.
Meanwhile, the Unix side continues to be "A House Divided Against Itself"
which I do not think can stand against a determined attack by a competitor
with the vast resources of Microsoft. (The anology is that Sun and the Unix
camp
is like the "South" and Microsoft is like the "North" with Oracle sitting
on the
sidelines much like a "Great Britain" did.)
It is horribly difficult for implementors (e.g. of Java, TCL) in the Unix
environment to
make multi-language projects robust with respect to all system conditions,
exceptions and future features.
Glue: Sure, glue is nice. But you cannot glue together wet wood. You have
to
cut away the rotting parts first before attempting a repair. And it is not
sound
to use glue to fill up gaps which are too large.
You guys integrating Java and TCL in the Unix environment really have your
work
cut out for you. Any serious competitor to Microsoft must address its
attack
from the point of view of component integration at the compiled-program
level,
and not merely be yet-another-platform-promising-portability while at the
same
time limiting implementors to a small set of languages.
-gjc
p.s. http://people.delphi.com/gjc reference for my own hacks.
------------------------------
Date: 15 Apr 1997 07:06:40 GMT
From: prikryl@dcse.fee.vutbr.cz (Petr Prikryl)
Subject: Re: Perl and MSDOS
Message-Id: <5iv9e0$4va$2@boco.fee.vutbr.cz>
Piet van Oostrum (piet@cs.ruu.nl) wrote:
>>>>>> "Smith A. Cat" <imbe@primenet.com> (SAC) writes:
>SAC> I know I am the ONLY person using Perl in MSDOS, but I would like to
>SAC> share my experience getting the latest Ilyaz port running "as
>SAC> advertised" under DOS:
You are not ;-)
[...]
>SAC> hex edited the perl.exe so that where it said f:/bin/sh.exe it
>SAC> now says c:4dos.com (shareware DOS command interpreter) so that
>SAC> the exe will spawn a subshell nicely.
The question is whether it does also other things so nicely. My understanding
is that sh does file globbing, backticks... Does 4dos.com understand
backticks?
>SAC> (also helps to hex edit rsx.exe so that the version reads c9.0. not
>SAC> necessary, but disables irritating emx (yes emx) version warning. most
>SAC> emx stuff seems to work with cwsdpmi and rsx, including TeX, metafont,
>SAC> and all the DJGPP stuff.)
>You could also get a new version of rsx.exe that is emx 0.9c compatible.
I also got the newer rsx and no editing was necessary.
>SAC> and after doing this can use the system, exec, and backtick functions
>SAC> very well, thank you! if you don't do all of these things you will
>SAC> absolutely NOT get system , exec, and backticks (``) working.
>I didn't do all these things, and still could get these working. But then I
>run it in a DOS box under MS Windows, maybe that's the difference.
Where the tests for this can be found? I have to try.
>See http://www.cs.ruu.nl/~piet/perl5dos.html
I did a similar recipe http://www.fee.vutbr.cz/~prikryl/ilya5004.txt
You are welcome to comment it or use the information for whatever
purpose you want except the commercial.
--
Petr Prikryl (prikryl@dcse.fee.vutbr.cz) http://www.fee.vutbr.cz/~prikryl/
TU of Brno, Dept. of Computer Sci. & Engineering; tel. +420-(0)5-7275 218
------------------------------
Date: 15 Apr 1997 23:56:03 GMT
From: mbzalgd@man.ac.uk (A. Deckers)
Subject: Re: Perl parsing
Message-Id: <slrn5l85cj.26i.mbzalgd@nessie.mcc.ac.uk>
In <33540245.5632@msp.sc.ti.com>,
Jayne Meiners <jayne@msp.sc.ti.com> wrote:
>If I am looking for one character out of a string.
>It doesn't matter if it is in the beginning, middle,
>or end.
>All I want to know is if it exists, what is the parsing
>sequence I need.
>
>This is the form I would like to have it:
>
>if (<that_x_character_exists>) {
>
> print "<that_x_character_exists>";
>
>
>}
I'm not sure I understand what you mean, but...
#!/usr/bin/perl -w
$char = 'c';
$word1 = 'abcdefgh';
$word2 = 'ijklmnop';
if ($word1 =~ /$char/) { print "yes\n"; }
if ($word2 =~ /$char/) { print "yes again\n"; }
__END__
Is that what you were looking for?
HTH,
--
Alain.Deckers@man.ac.uk <URL:http://www.man.ac.uk/%7Embzalgd/>
Perl information: <URL:http://www.perl.com/perl/>
Perl FAQ: <URL:http://www.perl.com/perl/faq/>
Perl software: <URL:http://www.perl.com/CPAN/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<
------------------------------
Date: 16 Apr 1997 00:29:45 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl parsing
Message-Id: <5j16hp$ae1$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Alain.Deckers@man.ac.uk writes:
:In <33540245.5632@msp.sc.ti.com>,
: Jayne Meiners <jayne@msp.sc.ti.com> wrote:
:#!/usr/bin/perl -w
:
:$char = 'c';
:
:$word1 = 'abcdefgh';
:$word2 = 'ijklmnop';
:
:if ($word1 =~ /$char/) { print "yes\n"; }
:if ($word2 =~ /$char/) { print "yes again\n"; }
Try it with $char eq '*' -- and you'll see you should
be using index. Why fire up a regexp, especially a
slow, run-time interpolated one, when you're not looking
for a pattern at all??
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Espousing the eponymous /cgi-bin/perl.exe?FMH.pl execution model is like
reading a suicide note -- three days too late."
--Tom Christiansen <tchrist@mox.perl.com>
------------------------------
Date: Tue, 15 Apr 1997 16:42:49 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl regular expressions - HTML
Message-Id: <pos0j5.p1v.ln@localhost>
TempStephenByrne@extonpo.bentley.com wrote:
: I am fairly new to Perl so forgive the simplicity of my question/example.
OK.
: I am trying to format some HTML documents that we have so that they will
: be consistent. Within the documents I am trying to fix the following.
: We have 3 cases:
: <dt><A HREF="/forum/index.html"><img src="/products/gif/greenb.gif"
: alt="*" border=0>The FORUM</A>
: <dt><A HREF="/forum/"><img src="/products/gif/greenb.gif" alt="*"
: border=0>The FORUM</A>
: <dt><A HREF="/forum">
: Case #1 is OK.
: Case #2 needs a "index.html" appended onto "/forum"
: Case #3 needs a "/" and a "index.html"
: Here's the Perl that I have currently: (this is about my 45th attempt ...
: I have tried everything)
: ## This one is supposed to append the "/"
: ## It assumes that all hrefs have been capitalized
: ##### problem is it puts "/" on the end of each href
: if (($_ =~ "HREF=\"") &&
: ($_ !~ "HREF=\"\/.+\/\">") &&
: ($_ !~ "http:") &&
: ($_ !~ "HREF=\"\/[\w\.\/]+\.\w{3,4}\">"))
I can't even figure out what you are trying to do here ;-(
You _are_ using an alternate pattern delimiter though (double quote).
The default is slash: $_ =~ /HREF="/;
If you want to use a different one (which you do, else you'll suffer
from backslashitis), then you must introduce it with an 'm':
$_ =~ m!HREF="!; # exclamation point as delimiter
^^ ^
Or, you can use "balanced" delimiters:
$_ =~ {HREF="}; # curly bracket delimiters
: {
: s/HREF=\"\/(.+)\">/HREF=\"\/\1\/\">/;
: }
See. Rampant backslashitis, seven unneeded backslashes... ;-)
You don't even _need_ to backslash those double quotes.
If you used an alternate delimiter, they you would not need _any_
backslashes:
s#HREF="/(.+)">#HREF="/$1/">#; # easier to read/understand too
^^
How come you are not using the -w command line switch to let
perl help you debug your scripts?
It would have mentioned that \1 is not the way back references are
done anymore.
[ snip ]
: I have also tried several mutations of this code, all of which come close
: but no cigar.
: Has anybody done this successfully? Or could somebody please provide
: some assistance for what I have provided above?
-----------------------------
#! /usr/bin/perl -w
while (<DATA>) {
s"/\""/index.html\""g; # ugly, but just to show that you can
# use double quotes if you want
# (but you don't want, if quotes are
# also in your pattern)
s#forum"#forum/index.html"#g;
print;
}
__DATA__
<dt><A HREF="/forum/index.html"><img src="/products/gif/greenb.gif" alt="*" bord
er=0>The FORUM</A>
<dt><A HREF="/forum/"><img src="/products/gif/greenb.gif" alt="*" border=0>The F
ORUM</A>
<dt><A HREF="/forum">
-----------------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 15 Apr 1997 23:50:38 GMT
From: lvirden@cas.org
Subject: Re: Perl-Books.
Message-Id: <5j148e$9ib@srv13s4.cas.org>
According to Randal Schwartz <merlyn@stonehenge.com>:
:Perl is a powerful tool in the hand of an expert. A beginner might
:have some difficulty. Best to stay for a while with some toy
:language, like Visual Basic or TCL. :-)
This is exactly the reputation that keeps more folk from using
Perl. How sad.
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: 16 Apr 1997 00:26:27 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Q: Uniq'ing a list
Message-Id: <5j16bj$ae1$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
p25a003@rrz.uni-hamburg.de writes:
:Would someone please be so kind and tell me how to uniq a list
:in perl without using the UNIX 'uniq' command ?
FAQ YOU
http://www.perl.com/perl/faq/
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Hey, I like C too, and have written uglier programs than that." --Larry Wall
------------------------------
Date: Tue, 15 Apr 1997 15:52:49 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: "Terrence M. Brannon" <brannon@bufo.usc.edu>
Subject: Re: question: How does one substitute into something other $_?
Message-Id: <335406C1.3141@egames.com>
[mail&post]
Terrence M. Brannon wrote:
> Every example I have seen in \\(learning\\|programming\\) perl uses $_
> for the substiution examples. Hence I have no idea how to do
> substitution in other variables.
1) open Camel.
2) look up substitution (s///) in index.
-> 26,46,57,72-74,529
3) 72-74 looks like juiciest section, go to pg72.
4) Oh, my! On pg 73 are numerous s/// examples, many
of them operating on something other than $_.
HTH
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"It's people like you wot cause unrest!"
------------------------------
Date: Wed, 16 Apr 1997 01:37:03 GMT
From: hbaker@netcom.com (Henry Baker)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <hbaker-1504971737030001@10.0.2.1>
In article <5j0gq5$jbi@mimsy.cs.umd.edu>, clin@cs.umd.edu (Charles Lin) wrote:
> If one had to choose a single type for everything, a string is a
> pretty good choice. Why not a number? How would you represent a
> string with a number?
Goedel showed how to represent everything with bignums.
------------------------------
Date: 16 Apr 1997 00:39:00 GMT
From: robinson@see-my-sig.com (Jim Robinson)
Subject: slices in scalar context - bug or feature?
Message-Id: <5j1734$617$1@vancouver.mdd.comm.mot.com>
An array in a scalar context will return the number of elements in the
array. However, it seems that a slice in a scalar context will result in
the last element of the array. Is this by design? I have looked thru
'info' for perl and I cannot find anywhere that would suggest what I am
observing.
In the example below, note the different results for scalar context.
(This is perl, version 5.003_02)
****************************************************************
[code]
@foo = qw(alpha beta gamma);
print "list context of list: ", join ' ', @foo, "\n";
print "list context of slice: ", join ' ', @foo[0..$#foo], "\n";
print "\n";
$scalar_list = @foo;
$scalar_slice = @foo[0..$#foo];
print "scalar context of list: $scalar_list\n";
print "scalar context of slice: $scalar_slice\n";
****************************************************************
[output]
list context of list: alpha beta gamma
list context of slice: alpha beta gamma
scalar context of list: 3
scalar context of slice: gamma
****************************************************************
What am I missing?
--
Jim Robinson
robinson@mdd.comm .mot.com # remove space in address
------------------------------
Date: 15 Apr 1997 23:05:13 GMT
From: "Tim Behrendsen" <tim@a-sis.com>
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <01bc49f1$5886b360$87ee6fce@timpent.a-sis.com>
Kaz Kylheku <kaz@vision.crest.nt.com> wrote in article <5j08c6$mjm@bcrkh13.bnr.ca>...
> [snip program]
> Splitting the file into 1.4 megabyte chunks is a logically separate operation
> from that of archiving and compression.
Well, sure, a program can be written to do anything. The point
is convenience.
And actually, this brings up a minor rant I have with Unix (off
the general point of the thread). Why don't we have a standard
floppy filesystem format? Why do I have stream stuff on raw sectors,
which means a bad block renders the entire floppy useless?
Considering the general "reliability" of 3 1/2 floppies, this is a
big irritation.
(or at least useless for Unix purposes. I can still use the
"superior" DOS O/S which supports a reasonable format. :-) )
--
==========================================================================
| Tim Behrendsen (tim@a-sis.com) | http://www.cerfnet.com/~timb |
| "Judge all, and be prepared to be judged by all." |
==========================================================================
------------------------------
Date: Tue, 15 Apr 1997 13:29:14 -1000
From: "Thomas S. Urban" <urban@unix.mauigateway.com>
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <33540F4A.73BEFFF5@unix.mauigateway.com>
Steve Mading wrote:
>
> Tim Behrendsen (tim@a-sis.com) wrote:
<snip, snip, snip, and snip>
> : Or how about self-extracting archives?
>
> A nice thing if you don't mind limiting yourself to one machine
> archetecture. (Imagine trying to run a self-extracting exe on
> Windows NT on a non-intel box like Alpha.) The Unix community
> does not want this feature since the Unix community has zillions
> of different archetectures to pass files between. Since gzip
> came from Unixy people - it has no self-extracting exe format.
> This has nothing to do with it being free and everything to do
> with it being from Unix.
Anecdote time: recently I was downloading tax forms from the
US Internal Revenue Service to print out at home. To their
credit, the IRS offered several different formats including
PDF and postscript. Running a linux system, I decided to
download the postscript format. All forms and documents
in the postscript came in self-extracting pkziped files!!
The IRS took a great cross-platform format (postscript) and
made it into a Wintel specific solution. When I download
the files, my system reported them as MS-DOS executables
(*.exe). I was so peaved I wrote an abusive e-mail to the
IRS. When I calmed down, I discovered the freeware program
unzip was able to decode the PS files out of their MS-DOS
shackles.
Just another crank,
Scott Urban
<snip>
> This is yet another example of why it is impossible to come up
> with a tool that is 'better than the rest, bar none'. Regardless
> of whether a tool is commercial or not. It's like trying to ask
> someone, "What's better, a Porsche or a dump truck?" Depends on
> what you are using it for, doesn't it?
------------------------------
Date: 16 Apr 1997 00:03:05 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Why doesn't until(<FILE> =~ /^\D/) { work?
Message-Id: <5j14vp$h1p@pirate.shu.edu>
htchapma@vela.acs.oakland.edu (H. Todd Chapman) writes:
>I wanted to use the following:
>until(<FILE> =~ /^\D/) {
> ($node, $x, $y, $z) = split;
> if (exists $nodes_hash{$node}) {
> $nodes_hash{$node} = join ' ', $x, $y, $z;
> }
>}
>but htat didn't work, so I tried:
>until(<FILE> =~ /^\D/) {
> ($node, $x, $y, $z) = split;
> if (exists $nodes_hash{$node}) {
> $nodes_hash{$node} = join ' ', $x, $y, $z;
> }
>}
If the first one didn't work, the second one won't either, since
they are identical :-)
>which also failed so I tried:
>while(<FILE>) {
etc.
until() doesn't magically assign to $_. You'll need to do
something like:
until ( ($_ = <FILE>) =~ /^\D/ ) { ... }
or use the while() version.
David Black
dblack@icarus.shu.edu
------------------------------
Date: 15 Apr 1997 22:30:46 GMT
From: brand@bnr.ca (Brand Hilton)
Subject: Re: Why is $Line=~ s///; erasing =
Message-Id: <5j0vim$gq@crchh327.rich.bnr.ca>
Sorry about the redundant response.
JEEZ, our news feed is slow!
Brand
--
---------------------------------------------------------
The opinions expressed here are not mine. I had my own opinions
surgically removed several years ago. They don't belong to BNR
or Northern Telecom, either, since they let their license lapse.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 310
*************************************