[29155] in Perl-Users-Digest
Perl-Users Digest, Issue: 399 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 2 21:09:43 2007
Date: Wed, 2 May 2007 18:09:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 2 May 2007 Volume: 11 Number: 399
Today's topics:
Re: Cant open a file with just a relative path <bik.mido@tiscalinet.it>
Re: capturing STDOUT from and piped "into" program <tbrazil@perforce.com>
Re: capturing STDOUT from and piped "into" program <tbrazil@perforce.com>
Help on expanding variable from sh jdoe987@gmail.com
Re: Help on expanding variable from sh <bik.mido@tiscalinet.it>
Re: I find the perl syntax easier than python <bik.mido@tiscalinet.it>
Re: I find the perl syntax easier than python <cwilbur@chromatico.net>
Re: I find the perl syntax easier than python <bik.mido@tiscalinet.it>
Re: I find the perl syntax easier than python <tadmc@augustmail.com>
Re: I find the perl syntax easier than python <cdalten@gmail.com>
Re: ignorance and intolerance in computing communties <edward.dodge@gmail.com>
Perl & SMS Question <amerar@iwc.net>
Re: perl Write filehandle blocks. <uri@stemsystems.com>
Perl6, Perl5, and CPAN flifus@gmail.com
Re: what is "}{"? <bik.mido@tiscalinet.it>
Re: what is "}{"? <bik.mido@tiscalinet.it>
Re: what is "}{"? <invalid@invalid.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 May 2007 23:21:59 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Cant open a file with just a relative path
Message-Id: <ihvh33565hbs8poq11vbc3ije8app98861@4ax.com>
On 30 Apr 2007 07:54:32 -0700, Nikos <nikos1337@gmail.com> wrote:
>>From now and on i'll post either here or imore preferably on
>Perlmonks which i get more efficient answers.
FWIW I choose where to post depending on the subject. OT posts are
discouraged in both places. But as a rough observation, ones that have
much to do with web server configuration or similar things, and very
little to do with Perl are better tolerated there, probably due to the
fact that it is a *web* based forum.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 2 May 2007 11:54:05 -0700
From: Tim <tbrazil@perforce.com>
Subject: Re: capturing STDOUT from and piped "into" program
Message-Id: <1178132045.100963.127840@l77g2000hsb.googlegroups.com>
On May 1, 2:35 pm, Paul Lalli <mri...@gmail.com> wrote:
> On May 1, 4:33 pm, Tim <tbra...@perforce.com> wrote:
>
>
>
> > Hi
>
> > I've read a lot good info on this list about capturing STDOUT but I'm
> > still having a problems grasping it. I think I'm missing something. I
> > am trying to capture the output from the "$p4 $spectype -i" command
> > and place it in a $scalar. I know I can't redirect directly into a
> > scalar.
>
> > open(FULLSPEC,"|$p4 $spectype -i");
> > print FULLSPEC @fullspec;
> > close(FULLSPEC);
>
> > Can someone please show me an example on how I can directly place the
> > output of the above example into a scalar variable?
>
> > Up to now I've cludged it by placing the output into a file and then
> > reading it however it's ugly.
>
> > open(FULLSPEC,"|$p4 $spectype -i > $outfile");
> > print FULLSPEC @fullspec;
> > close(FULLSPEC);
>
> > open(OUTPUT,"<$outfile");
> > $specout = <OUTPUT>;
> > close(OUTPUT);
> > chomp($specout);
> > unlink($outfile);
> > return $specout;
>
> perldoc -q pipe
> Found in /software/perl-5.8.5-0/pkg/lib/5.8.5/pod/perlfaq8.pod
> How can I open a pipe both to and from a command?
>
> http://perldoc.perl.org/IPC/Open2.html
>
> [untested]
> use IPC::Open2;
> my $pid = open2(my $read_fh, my $write_fh, "$p4 $spectype -i");
> print $write_fh @fullspec;
> my $specout = do { local $/; <$read_fh> };
>
> Hope this helps,
> Paul Lalli
Hi Paul
I'm not sure whether you saw my respone. Thaniks for your input! - Tim
#####
Hi Paul and Xho
I really appreciate your responses. I initially tried Paul's solution.
It did indeed work on my OSX and Linux box. I was singing praises to
Paul but then I tried it on Windows XP with Activestate...
unfortunately it locked up.
I then went to try your solution.. It appears that IPC::Run is only
available in a separate package. I forgot to mention one detail ....
I'm attempting to write a perl benchmark test that customers could use
in their own perl environment without having them add additional
packages. :(
I'm using v5.8.5 on Linux and 5.8.8 Activestate on Windows. Knowing
what I just mentioned, any other ideas? Once again, thank you guys
VERY much for the info.
Tim
------------------------------
Date: 2 May 2007 12:02:43 -0700
From: Tim <tbrazil@perforce.com>
Subject: Re: capturing STDOUT from and piped "into" program
Message-Id: <1178132563.310769.69320@q75g2000hsh.googlegroups.com>
> How big was "@fullspec"? If it was big, then it maybe a buffering issue
> that can solved with select. Even if it were not big, it still might be
> one, but is likely.
>
> > I then went to try your solution.. It appears that IPC::Run is only
> > available in a separate package.
>
> IPC::Run seems to be pure perl, and the source code is available, and thus
> the source of it can be incorporated anywhere. I would assume its terms of
> use would allow that, but I didn't check the license file--you should if
> you want to use it that way. In any event, the ideas behind the package
> are surely available to you.
>
> Xho
>
Hi Xho
The input to @fullspec can vary. It can be VERY large (it is a source
control changelist for a branch). It can be 10,000 lines depending on
the dataset. The output is only one line.. the change number. Here is
a input file.
$ ls -l out
-rw-r--r-- 1 me me 133246 May 2 11:48 out
$ wc out
1454 4406 133246 out
dataset sample:
//depot/r45.0.0/0Jam/MAIN/src/RELNOTES # branch
//depot/r45.0.0/0Jam/MAIN/src/command.c # branch
//depot/r45.0.0/0Jam/MAIN/src/command.h # branch
//depot/r45.0.0/0Jam/MAIN/src/compile.c # branch
//depot/r45.0.0/0Jam/MAIN/src/compile.h # branch
//depot/r45.0.0/0Jam/MAIN/src/execcmd.h # branch
I'll look into IPC:Run a bit closer - Thx! Tim
------------------------------
Date: 2 May 2007 12:36:56 -0700
From: jdoe987@gmail.com
Subject: Help on expanding variable from sh
Message-Id: <1178134616.348732.164080@n76g2000hsh.googlegroups.com>
This may sound like a simple question - but I am a newbie at perl.
Most of my scripting is in sh. Anyway - I am having problems with the
command below. specifically in the perl command.
for HOST in `ypcat netgroup| grep foobar;; do ping $HOST 2 >> /dev/
null; if [ $? -eq 0 ]; then perl -e 'alarm(3); exec qw/rsh -n \{$HOST}
\ uname -a /'; fi;done
The $HOST variable is only being expanded on the first host. After
that it loops stating:
{$HOST}: unknown host
Any help and an explanation on what the correct syntax is would be
appreciated.
------------------------------
Date: Wed, 02 May 2007 21:48:39 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Help on expanding variable from sh
Message-Id: <shqh331caikdadv0od3lc5a76o0v3qovbe@4ax.com>
On 2 May 2007 12:36:56 -0700, jdoe987@gmail.com wrote:
>This may sound like a simple question - but I am a newbie at perl.
You welcome!
>Most of my scripting is in sh. Anyway - I am having problems with the
You will switch gradually, if needed.
>command below. specifically in the perl command.
>
>for HOST in `ypcat netgroup| grep foobar;; do ping $HOST 2 >> /dev/
>null; if [ $? -eq 0 ]; then perl -e 'alarm(3); exec qw/rsh -n \{$HOST}
>\ uname -a /'; fi;done
Perl usage is really minimal here.
>The $HOST variable is only being expanded on the first host. After
So far I think you have a shell quoting problem. To go on topic,
however, you can access the $HOST environment variable directly IN
Perl by means of the %ENV variable. $ENV{HOST} should do the trick.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 02 May 2007 22:23:17 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: I find the perl syntax easier than python
Message-Id: <7vqh339jps8hbki5biisah7iaf0nlctdcn@4ax.com>
On 29 Apr 2007 21:29:54 -0700, grocery_stocker <cdalten@gmail.com>
wrote:
>Versalitily isn't always a good thing. This might be stretching the
>realms of funky Perl code, but consider the following two programs
>that will add two numbers.
Well, you're right. However there's a remark I always feel like making
when speaking of Perl's TMTOWTDIness: it's true that there's more than
one way to do it. But it's also true that for common situations there
is often a preferred way to do it. Or a few preferred ways, with
different advantages in different respects. So, if you have e.g. to
iterate over a range of numbers "the" WTDI is
for ($MIN..$MAX) { # ...
and if you have to iterate over a handle, then "the" WTDI is
while (<$fh>) { # ...
Please take all this with a grain of salt, of course.
Perl 6 aims at being even more multiparadigmatic than 5, and to stay
at the same time consistent. So thanks to lazy evaluation, you will
e.g. both
.say for 1..6; # and
.say for $fh;
>sub modify{
> my $value = $_[0] + $_[1];
> print "$value \n";
BTW: what is it, with that space?
>sub modify{
> my $first=shift;
> my $second=shift;
> my $value = $first + $second;
> print "$value \n";
These are perfectly equivalent. Both have probably a mischosen name,
since they do not modify anything, but add and print two numbers. The
former, for such an easy task, is probably preferable. But in that
case I would avoid the $value variable altogether.
Since I mentioned Perl 6 above, in it eventually we will have more
convenient ways and less ambiguity in passing parameters. We will
still be able to use @_ & C. but who does really need them when you
can do
sub addprint ($n,$m) { say $n+$m } # ?
(And you would add type declarations for $n and $m if you want to keep
safe for cheap.)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 02 May 2007 16:33:27 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: I find the perl syntax easier than python
Message-Id: <87ejlzvuco.fsf@mithril.chromatico.net>
>>>>> "MD" == Michele Dondi <bik.mido@tiscalinet.it> writes:
MD> Well, you're right. However there's a remark I always feel
MD> like making when speaking of Perl's TMTOWTDIness: it's true
MD> that there's more than one way to do it. But it's also true
MD> that for common situations there is often a preferred way to
MD> do it. Or a few preferred ways, with different advantages in
MD> different respects.
More concisely: TMTOWTDI, but some ways are better than others.
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: Wed, 02 May 2007 23:10:06 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: I find the perl syntax easier than python
Message-Id: <upsh33tohcg7ts9slt6eb433sgd5uca99g@4ax.com>
On 29 Apr 2007 22:08:41 -0700, grocery_stocker <cdalten@gmail.com>
wrote:
>This depends on how you view Perl. Perl can be viewed as either
>Procedural or Object Oriented paradigm
Perl can be viewed as a multiparadigmatic language supporting amongst
others procedural and object oriented paradigms. It has always been,
it's become more, it will be even more.
Now, Perl's current OO model is both weak, due to it being an
afterthought rather than a primary design choice, and charming for the
powerful and far reaching consequences it gets out of an extremely
simple structure constituted by a single "special" function and a tiny
bag of syntactic sugar. Perl 6's OO'ness will be pervasive but not
invasive: everything will be an object, but you won't be *forced* to
think of it as such.
>> I also like the versatility of the syntax. That said, although it's
>> versatile, it also seemed consistent.
>>
>Versatility isn't always a good thing. Sometimes this can lead to
>stuff being inconsistent. Consider the following code I duped from a
>Google search -).
>sub alter ($) {
> $_[0]= $_[0] . " blub";
>
>}
This is a well chosen name for a sub that spots a well documented
charachteristic of the special @_ array to actually modify a value.
>sub alter ($) {
> my $string = shift;
> $string = $string . " blub";
>}
This is an example of a sub with a badly chosen name for it uses a
different parameter passing mechanism that is similarly well
documented not to be usable to modify a value.
>> Python just annoyed me a little. It was just inconsistent.
Actually I would have thought it to be *more* consistent.
>In the end, all programming languages are just fagged up versions of
>Lisp. Don't believe it? The following URL makes from some interesting
Well, not really! ;-)
>late night reading
>
>http://www.paulgraham.com/icad.html
Indeed!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 2 May 2007 18:57:34 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: I find the perl syntax easier than python
Message-Id: <slrnf3i9be.kti.tadmc@tadmc30.august.net>
Charlton Wilbur <cwilbur@chromatico.net> wrote:
>>>>>> "MD" == Michele Dondi <bik.mido@tiscalinet.it> writes:
>
> MD> Well, you're right. However there's a remark I always feel
> MD> like making when speaking of Perl's TMTOWTDIness: it's true
> MD> that there's more than one way to do it. But it's also true
> MD> that for common situations there is often a preferred way to
> MD> do it. Or a few preferred ways, with different advantages in
> MD> different respects.
>
> More concisely: TMTOWTDI, but some ways are better than others.
More humorously:
There are 9 ways to do the same thing in Perl, and 8 of them are no good!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 2 May 2007 17:49:18 -0700
From: grocery_stocker <cdalten@gmail.com>
Subject: Re: I find the perl syntax easier than python
Message-Id: <1178153358.243901.320170@p77g2000hsh.googlegroups.com>
On May 2, 1:23 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On 29 Apr 2007 21:29:54 -0700, grocery_stocker <cdal...@gmail.com>
> wrote:
>
> >Versalitily isn't always a good thing. This might be stretching the
> >realms of funky Perl code, but consider the following two programs
> >that will add two numbers.
>
> Well, you're right. However there's a remark I always feel like making
> when speaking of Perl's TMTOWTDIness: it's true that there's more than
> one way to do it. But it's also true that for common situations there
> is often a preferred way to do it. Or a few preferred ways, with
> different advantages in different respects. So, if you have e.g. to
> iterate over a range of numbers "the" WTDI is
>
> for ($MIN..$MAX) { # ...
>
> and if you have to iterate over a handle, then "the" WTDI is
>
> while (<$fh>) { # ...
>
> Please take all this with a grain of salt, of course.
>
> Perl 6 aims at being even more multiparadigmatic than 5, and to stay
> at the same time consistent. So thanks to lazy evaluation, you will
> e.g. both
>
> .say for 1..6; # and
> .say for $fh;
>
> >sub modify{
> > my $value = $_[0] + $_[1];
> > print "$value \n";
>
> BTW: what is it, with that space?
>
Just a habit I've gotten into.
------------------------------
Date: 2 May 2007 13:52:08 -0700
From: Edward <edward.dodge@gmail.com>
Subject: Re: ignorance and intolerance in computing communties
Message-Id: <1178139128.848251.102020@y80g2000hsf.googlegroups.com>
On May 2, 8:33 am, Xah Lee <x...@xahlee.org> wrote:
<snip>
> As i have indicated in my post, it is non-trivial to implement a
> function that returns the positive angle of a vector. For example, it
> can be done with sign checking of the coordinate components (in total
> 4 cases, which can be done as 2 levels of nesting if, or simply 4
> if.), and or the evaluation of Min[Abs[ArcCos[x],Abs[ArcSin[x]]], or
> use clever ways with dot product, or ArcTan. It is not a trivial to
> know which algorithm is in general more efficient. (this is important,
> since finding the angle of a vector is a basic function, that may
> needs to be called millions times directly or indirectly) Further,
> consider the inverse trig function, it is likely 99.99% of people with
> a PH D in math wouldn't know how these are actually implemented. So,
> the question of whether calling one of the inverse trig function is
> more robust or efficient than another is a open question. And, besides
> the algorithmic level, the question also entails how the language
> actually implement the inverse trig functions.
<snip>
"We should forget about small efficiencies, say about 97% of the time:
premature optimization is the root of all evil."
The question you are asking depends a great deal on other factors
outside of the coding environment such as the compiler and the
hardware. If you are coding for a specific language/compiler/hardware
combination, all you need do is profile different versions of your
code until you're happy with the results.
------------------------------
Date: 2 May 2007 15:28:53 -0700
From: "amerar@iwc.net" <amerar@iwc.net>
Subject: Perl & SMS Question
Message-Id: <1178144933.541496.251280@n76g2000hsh.googlegroups.com>
Hi All,
I'm looking for a module that will allow me, from a Perl script, to
senda text message to a cell phone.
I would rather not use the email approach, as people change providers
and such. So, I'd rather use the phone number.
I've trued NET::SMS and WWW::SMS and neither work. NET::SMS requires
me to pay some subscription to a place, and WWW::SMS just plain
failed......
Can anyone else help??
Thanks!!
------------------------------
Date: Wed, 02 May 2007 16:17:36 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: perl Write filehandle blocks.
Message-Id: <x7r6pzj7z3.fsf@mail.sysarch.com>
>>>>> "x" == xhoster <xhoster@gmail.com> writes:
x> Uri Guttman <uri@stemsystems.com> wrote:
>> >>>>> "JS" == Joe Smith <joe@inwap.com> writes:
>>
JS> perldoc IPC::Open2
>>
JS> It's cases like this where the parent should fork two children:
JS> one that can block while writing to $WTR yet not preventing the
>> other JS> fork from reading from $RDR at the same time.
>>
>> way too much work when an event loop in the parent can handle the open2
>> and more all by itself.
x> I have a hard time seeing how coding a simple fork is more work than
x> writing an event loop.
the previous post mentioned TWO forks and managing that is much more
difficult than one fork with only input or output (or even open2 if
blocking can't happen). using an event loop eliminated the deadlock
issue and allows for scaling to more things such as sockets, guis, etc.
>> your idea can still deadlock if the parent
>> doesn't manage correctly the i/o of the pair of children.
x> Sure, and it is possible to code an event loop incorrectly.
who write event loops anymore? there are several modules that do all the
work and in general they are fairly easy to use. the biggest issue is
altering your mindset to a callback style of coding.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 2 May 2007 14:59:33 -0700
From: flifus@gmail.com
Subject: Perl6, Perl5, and CPAN
Message-Id: <1178143173.773533.160160@q75g2000hsh.googlegroups.com>
Hi all. I'm about to slug my way through half a dozen perl books, as I
want to learn it. What will happen when Perl6 come along? What will
happen to my Perl5 knowledge? and, what will happen to CPAN's Perl5
modules? Thanks.
------------------------------
Date: Wed, 02 May 2007 21:14:48 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: what is "}{"?
Message-Id: <dooh3352ludl4gi3fmtued9lq4q4lqf68l@4ax.com>
On 2 May 2007 11:01:09 -0700, Klaus <klaus03@gmail.com> wrote:
>> 1. This code adds a column of numbers: perl -lne '$x+=$_}{print $x;'
>> What is the purpose of "}{"?
>
>You are using "-n" in a very clever way indeed:
s/You are/Someone is/; # :-)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 02 May 2007 21:21:30 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: what is "}{"?
Message-Id: <tpoh3314kgunvcq565jkaebig2k9oj6pi9@4ax.com>
On 2 May 2007 10:39:58 -0700, zenny lenny <zennylenny@gmail.com>
wrote:
>Subject: what is "}{"?
news://er8luv$268s$1@ns.felk.cvut.cz
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 2 May 2007 15:23:36 -0400
From: "Wade Ward" <invalid@invalid.net>
Subject: Re: what is "}{"?
Message-Id: <M8ydnYBnp-eneKXbnZ2dnUVZ_tqnnZ2d@comcast.com>
<attn.steven.kuo@gmail.com> wrote in message
news:1178129152.457542.266120@n76g2000hsh.googlegroups.com...
> On May 2, 10:39 am, zenny lenny <zennyle...@gmail.com> wrote:
>> I DID check the FAQ first.
>>
>> Two questions:
>>
>> 1. This code adds a column of numbers: perl -lne '$x+=$_}{print $x;'
>>
>> What is the purpose of "}{"?
>>
>> 2. Is there any way to search groups or the web for symbols like "}
>> {"? Google seems to ignore symbols like this.
>
>
>
> Heh, that's intentional obfuscation. Abigail explains it
> here (see the "Counting Lines" section):
>
> http://ucan.foad.org/~abigail/Perl/Talks/Japhs/
>
> The -n switch (see 'perldoc perlrun') wraps your
> code, similar to -p but without the continue and
> print portion.
>
> You can also use a module to make things clearer:
>
> $ perl -MO=Deparse -nle '$x+=$_}{print $x;'
>
> BEGIN { $/ = "\n"; $\ = "\n"; }
> LINE: while (defined($_ = <ARGV>)) {
> chomp $_;
> $x += $_;
> }
> {
> print $x;
> }
> -e syntax OK
Aren't they just curly braces that are guaranteed to be unmatched? A google
search would hit every entry that has two or more sets of curly braces.
--
Wade Ward
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 399
**************************************