[31634] in Perl-Users-Digest
Perl-Users Digest, Issue: 2897 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 31 18:09:44 2010
Date: Wed, 31 Mar 2010 15:09:19 -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, 31 Mar 2010 Volume: 11 Number: 2897
Today's topics:
Re: equivalent <tadmc@seesig.invalid>
Re: equivalent <ben@morrow.me.uk>
Re: equivalent <ben@morrow.me.uk>
Re: equivalent <RedGrittyBrick@spamweary.invalid>
Re: FAQ 6.9 How can I quote a variable to use in a rege <Phred@example.invalid>
Re: FAQ 6.9 How can I quote a variable to use in a rege <jurgenex@hotmail.com>
Re: FAQ 6.9 How can I quote a variable to use in a rege <willem@turtle.stack.nl>
Re: FAQ 6.9 How can I quote a variable to use in a rege sln@netherlands.com
Re: FAQ 6.9 How can I quote a variable to use in a rege <Phred@example.invalid>
Re: FAQ 6.9 How can I quote a variable to use in a rege <willem@turtle.stack.nl>
Re: FAQ 6.9 How can I quote a variable to use in a rege <ben@morrow.me.uk>
Re: FAQ 6.9 How can I quote a variable to use in a rege <ben@morrow.me.uk>
Re: FAQ 6.9 How can I quote a variable to use in a rege <spamtrap@shermpendley.com>
Re: FAQ 6.9 How can I quote a variable to use in a rege <spamtrap@shermpendley.com>
Re: FAQ 6.9 How can I quote a variable to use in a rege <Phred@example.invalid>
Re: FAQ 6.9 How can I quote a variable to use in a rege <Phred@example.invalid>
Perl Errors <salehh229@gmail.com>
Re: Perl Errors <jurgenex@hotmail.com>
Re: the mug of Perl <keith.watson@cc.gatech.edu>
Re: unary minus strangeness <nospam-abuse@ilyaz.org>
Re: unary minus strangeness <marc.girod@gmail.com>
Re: unary minus strangeness <blgl@hagernas.com>
Re: unary minus strangeness <ben@morrow.me.uk>
Re: using Print << marker with require statement? <spamtrap@shermpendley.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 30 Mar 2010 21:16:06 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: equivalent
Message-Id: <slrnhr5brh.ne2.tadmc@tadbox.sbcglobal.net>
sreservoir <sreservoir@gmail.com> wrote:
> On 3/30/2010 8:33 PM, Tad McClellan wrote:
>> OP should see the docs section "Indirect Object Syntax" in perlobj.pod.
> out of curiosity, what did it do in perl4?
Follow-upper should see the docs section "Indirect Object Syntax" in
perlobj.pod too.
:-)
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Wed, 31 Mar 2010 08:16:14 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: equivalent
Message-Id: <ue9b87-4nc1.ln1@osiris.mauzo.dyndns.org>
Quoth sreservoir <sreservoir@gmail.com>:
>
> this is, incidentally, slightly ridiculous.
>
> % perl -E'sub STDOUT::a { die "right blocking" }
> say((*{STDOUT}{PACKAGE})->blocking);'
> Can't locate object method "blocking" via package "main" at -e line 2.
>
> um.
*STDOUT{PACKAGE} returns a string indicating which package *STDOUT is
in, in this case "main". And no, it doesn't get preferentially treated
as a package name, not even if you use *STDOUT::new{PACKAGE}.
Ben
------------------------------
Date: Wed, 31 Mar 2010 08:21:33 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: equivalent
Message-Id: <to9b87-4nc1.ln1@osiris.mauzo.dyndns.org>
Quoth Tad McClellan <tadmc@seesig.invalid>:
> Ben Morrow <ben@morrow.me.uk> wrote:
>
> > Method calls like
> >
> > new Class;
> > method $object;
> > method $object @args; # note the lack of comma after $object
> >
> > are in a form usually called 'indirect object syntax'[0]. This was added
> > into Perl when objects were first introduced (5.000, I believe),
>
> OP should see the docs section "Indirect Object Syntax" in perlobj.pod.
Yes.
> But it contradicts Ben too:
>
> The other way to invoke a method is by using the so-called "indirect
> object" notation. This syntax was available in Perl 4 long before
> objects were introduced...
(It's a long time since I've read perlobj.) Hmm, I suppose that's true,
after a fashion. It's referring to the
print FH "foo";
syntax that I said
ungetc $FH "foo";
was supposed to be imitating. It doesn't apply to anything other than a
very small handful of builtins (are there actually any others?).
Ben
------------------------------
Date: Wed, 31 Mar 2010 10:38:58 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: equivalent
Message-Id: <4bb31833$0$2540$da0feed9@news.zen.co.uk>
On 30/03/2010 22:10, Justin C wrote:
> In article<h44887-vcl.ln1@osiris.mauzo.dyndns.org>, Ben Morrow wrote:
>>
>> Quoth sreservoir<sreservoir@gmail.com>:
>>> On 3/29/2010 6:00 PM, RedGrittyBrick wrote:
>>>> Dr.Ruud wrote:
>>>>> RedGrittyBrick wrote:
>>>>>
>>>>>> my $query = new CGI;
>>>>>
>>>>> ITYM:
>>>>>
>>>>> my $cgi = CGI::->new();
>>>>>
>>>>
>>>> Yes, I did hesitate over that. In the end I copied what is in the
>>>> documentation http://perldoc.perl.org/CGI.html#PROGRAMMING-STYLE.
>>>>
>>>> I've actually forgotten the pitfalls of the, er, deprecated syntax.
>>>> Perusing perlobj, perlboot and perltoot didn't help me (though I wasn't
>>>> very thorough). Is it anything to do with naming your constructor shazam
>>>> and writing `my $instance = shazam OddObject'. Though it works,
>>>> presumably as intended, I guess that sort of thing can confuse people&
>>>> perl?
>>>>
>>>> So, why is `CGI::->new()' preferred over `CGI->new()' preferred over
>>>> `new CGI()'?
>>>
>>> it isn't, unless someone's stupid enough to make&new or&CGI. it's
>>> just less ambiguous:
>>
>> Having a 'sub new' in scope is not uncommon:
>>
>> package Foo;
>>
>> sub new { ... }
>>
>> sub init { my $x = CGI->new(...) }
>>
>> 1;
>>
>>> new CGI chokes if there is a&new or a&CGI.
>>
>> Not if you do it properly, that is
>>
>> new CGI ();
>>
>> rather than a bare
>>
>> new CGI;
>>
>> The latter is a little too ambiguous even for Perl.
>>
>>> CGI->new chokes if there is a&CGI. might do bad things if CGI isn't
>>> require'd or use'd.
>>
>> You mean 'if the CGI->new method isn't defined'.
>>
>>> 'CGI'->new almost always does the right thing.
>>
>> use IO::Handle;
>> warn "STDOUT"->blocking;
>>
>> Yes, this is 'the right thing' in this case, but not always. Just don't
>> open a filehandle called 'CGI'.
>>
>>> CGI::->new is syntactic sugar for 'CGI'->new.
>>
>> For CGI->new, except it ignores any 'sub CGI'.
>>
>> Ben
>
> Well thanks a whole *huge* bunch, guys. Just when I start thinking I'm
> starting to understand what I'm doing you go and confuse the hell out of
> me! I spend a lot of my time in this group reading that I should refer
> to documentation, and then you go and contradict the damn documentation!
> OK, I accept that the module documentation isn't Perl documentation, but
> that's a heavily used module, and it says quite clearly (unless I need
> to update it):
>
> use CGI;
> $q = new CGI;
> print $q->header, ....
>
> If you can't explain it to me simply can you point me to some docs... I
> see a Catch 22 here.
>
---------------------------8<----------------------
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use Data::Dumper;
foo();
sub CGI { print "Subroutine 'CGI' called\n"; }
sub new { print "Subroutine 'new' called\n"; }
sub foo {
my $query;
$query = new CGI; print Dumper(\$query);
$query = 'CGI'->new; print Dumper(\$query);
$query = CGI::->new; print Dumper(\$query);
$query = CGI->new; print Dumper(\$query);
}
---------------------------8<----------------------
:!perl testnew.pl
Subroutine 'CGI' called
Subroutine 'new' called
$VAR1 = \'1';
$VAR1 = \bless( {
'.parameters' => [],
'.charset' => 'ISO-8859-1',
'.fieldnames' => {}
}, 'CGI' );
$VAR1 = \bless( {
'.parameters' => [],
'.charset' => 'ISO-8859-1',
'.fieldnames' => {}
}, 'CGI' );
Subroutine 'CGI' called
Can't call method "new" without a package or object reference at
testnew.pl line 16.
--
RGB
------------------------------
Date: Wed, 31 Mar 2010 13:56:17 -0600
From: Phred Phungus <Phred@example.invalid>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <81hnn2F604U1@mid.individual.net>
Jürgen Exner wrote:
> Phred Phungus <Phred@example.invalid> wrote:
>> Jürgen Exner wrote:
>>> Phred Phungus <Phred@example.invalid> wrote:
>>>> PerlFAQ Server wrote:
>>>>> $string = "Placido P. Octopus";
>>>>> $regex = "P.";
>>>>>
>>>>> $string =~ s/$regex/Polyp/;
>>>>> # $string is now "Polypacido P. Octopus"
>>>>>
>>>>> Because "." is special in regular expressions, and can match any single
>>>>> character, the regex "P." here has matched the <Pl> in the original
>>>>> string.
>>>>>
>>>> Am I then correct that a period is not a character?
>>> How did you come to that conclusion?
>> Because the regex would then match the middle initial and the string
>> would be "Polypacido Polyp Octopus".
>
> No, it wouldn't because there is no /g modifier in the s///-operation.
$ perl perl1.pl
Placido P. Octopus
Polypacido P. Octopus
Placido P. Octopus
Placido P. Octopus
$ cat perl1.pl
#!/usr/bin/perl
use strict;
use warnings;
my $string = "Placido P. Octopus\n";
my $regex = "P.";
print $string;
$string =~ s/$regex/Polyp/;
print $string;
my $string2 = "Placido P. Octopus\n";
print $string2;
$string =~ s/$regex/Polyp/g;
print $string2;
$
I don't know what I'm doing wrong here. Semi-colons are there. Strings
have newlines. Syntax looks like pp. 147 & 153 in Programming Perl.
??
--
fred
------------------------------
Date: Wed, 31 Mar 2010 13:08:36 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <daa7r55fsvbliercq497p49ft5kjfgh5j2@4ax.com>
Phred Phungus <Phred@example.invalid> wrote:
>Jürgen Exner wrote:
>> Phred Phungus <Phred@example.invalid> wrote:
>>> Jürgen Exner wrote:
>>>> Phred Phungus <Phred@example.invalid> wrote:
>>>>> PerlFAQ Server wrote:
>>>>>> $string = "Placido P. Octopus";
>>>>>> $regex = "P.";
>>>>>>
>>>>>> $string =~ s/$regex/Polyp/;
>>>>>> # $string is now "Polypacido P. Octopus"
>>>>>>
>>>>>> Because "." is special in regular expressions, and can match any single
>>>>>> character, the regex "P." here has matched the <Pl> in the original
>>>>>> string.
>>>>>>
>>>>> Am I then correct that a period is not a character?
>>>> How did you come to that conclusion?
>>> Because the regex would then match the middle initial and the string
>>> would be "Polypacido Polyp Octopus".
>>
>> No, it wouldn't because there is no /g modifier in the s///-operation.
>
>$ perl perl1.pl
>Placido P. Octopus
>Polypacido P. Octopus
>Placido P. Octopus
>Placido P. Octopus
>$ cat perl1.pl
>#!/usr/bin/perl
>
>use strict;
>use warnings;
>
>my $string = "Placido P. Octopus\n";
>my $regex = "P.";
>print $string;
>$string =~ s/$regex/Polyp/;
>print $string;
>
>my $string2 = "Placido P. Octopus\n";
>print $string2;
>$string =~ s/$regex/Polyp/g;
>print $string2;
>$
>
>I don't know what I'm doing wrong here.
You showed us your code: good.
You showed us your output: good.
You did not tell us what output you expected nor how the actual output
is different from your expected output: very bad. An error description
should always include an "expected" section.
To me your program produces exactly the output I would have expect:
First the content of $string,
then the same string again after a single substitution,
then the content of $string2
then the identical content of $string2 again.
>Semi-colons are there. Strings have newlines.
Well, fine, but not really relevant.
>Syntax looks like pp. 147 & 153 in Programming Perl.
Well, yeah, perl didn't report a syntax error, so in all probability you
don't have one.
jue
------------------------------
Date: Wed, 31 Mar 2010 20:09:53 +0000 (UTC)
From: Willem <willem@turtle.stack.nl>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <slrnhr7b0h.22l1.willem@turtle.stack.nl>
Phred Phungus wrote:
) $ perl perl1.pl
) Placido P. Octopus
) Polypacido P. Octopus
) Placido P. Octopus
) Placido P. Octopus
) $ cat perl1.pl
) #!/usr/bin/perl
)
) use strict;
) use warnings;
)
) my $string = "Placido P. Octopus\n";
) my $regex = "P.";
) print $string;
) $string =~ s/$regex/Polyp/;
) print $string;
)
) my $string2 = "Placido P. Octopus\n";
) print $string2;
) $string =~ s/$regex/Polyp/g;
) print $string2;
) $
)
) I don't know what I'm doing wrong here. Semi-colons are there. Strings
) have newlines. Syntax looks like pp. 147 & 153 in Programming Perl.
You made a typo, that's what.
For education, I'll let you figure it out yourself.
PS: Good thing that you copy-pasted the code. That shows very nicely
why copy-pasting is the only way to go when asking usenet questions.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
------------------------------
Date: Wed, 31 Mar 2010 13:11:07 -0700
From: sln@netherlands.com
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <1ra7r5h354qqlusdm7fdvdmju8o2io9gtp@4ax.com>
On Wed, 31 Mar 2010 13:56:17 -0600, Phred Phungus <Phred@example.invalid> wrote:
>I don't know what I'm doing wrong here.
>>>>>> Because "." is special in regular expressions, and can match any single
>>>>>> character
What is it you are doing?
$hhh = "ABCDE";
$hhh =~ s/././g;
print $hhh;
------------------------------
Date: Wed, 31 Mar 2010 14:45:52 -0600
From: Phred Phungus <Phred@example.invalid>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <81hqk1Fnk9U1@mid.individual.net>
Willem wrote:
> Phred Phungus wrote:
> ) my $string2 = "Placido P. Octopus\n";
> ) print $string2;
> ) $string =~ s/$regex/Polyp/g;
> ) print $string2;
> ) $
> )
> ) I don't know what I'm doing wrong here. Semi-colons are there. Strings
> ) have newlines. Syntax looks like pp. 147 & 153 in Programming Perl.
>
> You made a typo, that's what.
> For education, I'll let you figure it out yourself.
>
> PS: Good thing that you copy-pasted the code. That shows very nicely
> why copy-pasting is the only way to go when asking usenet questions.
Uff.
$ perl perl1.pl
Placido P. Octopus
Polypacido P. Octopus
Placido P. Octopus
Polypacido Polyp Octopus
$ cat perl1.pl
#!/usr/bin/perl
use strict;
use warnings;
my $string = "Placido P. Octopus\n";
my $regex = "P.";
print $string;
$string =~ s/$regex/Polyp/;
print $string;
my $string2 = "Placido P. Octopus\n";
print $string2;
$string2 =~ s/$regex/Polyp/g;
print $string2;
$ perl1.pl
bash: perl1.pl: command not found
$
Ok the regex part of it works, now, but I've got one more little thing
that doesn't really have to do with perl properly, but since the context
is here ...
I thought the idea for the shebang line was that my OS was going to
interpret the script with perl. I do have a /usr/bin/perl, so I thought
that typing perl1.pl at the prompt would be the same as typing perl
perl1.pl, but manifestly, it is not. What gives?
--
fred
------------------------------
Date: Wed, 31 Mar 2010 20:47:46 +0000 (UTC)
From: Willem <willem@turtle.stack.nl>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <slrnhr7d7i.232u.willem@turtle.stack.nl>
Phred Phungus wrote:
) $ perl1.pl
) bash: perl1.pl: command not found
) $
)
) I thought the idea for the shebang line was that my OS was going to
) interpret the script with perl. I do have a /usr/bin/perl, so I thought
) that typing perl1.pl at the prompt would be the same as typing perl
) perl1.pl, but manifestly, it is not. What gives?
chmod +x perl1.pl
For more detail, ask in a unix froup.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
------------------------------
Date: Wed, 31 Mar 2010 21:51:54 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <a8pc87-0rp1.ln1@osiris.mauzo.dyndns.org>
Quoth Phred Phungus <Phred@example.invalid>:
>
> $ perl perl1.pl
> Placido P. Octopus
> Polypacido P. Octopus
> Placido P. Octopus
> Placido P. Octopus
> $ cat perl1.pl
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my $string = "Placido P. Octopus\n";
> my $regex = "P.";
> print $string;
> $string =~ s/$regex/Polyp/;
> print $string;
>
> my $string2 = "Placido P. Octopus\n";
> print $string2;
> $string =~ s/$regex/Polyp/g;
^^^^^^^
> print $string2;
^^^^^^^^
One of these things is not like the other.
Ben
------------------------------
Date: Wed, 31 Mar 2010 21:54:05 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <dcpc87-0rp1.ln1@osiris.mauzo.dyndns.org>
Quoth Willem <willem@turtle.stack.nl>:
> Phred Phungus wrote:
> ) $ perl1.pl
> ) bash: perl1.pl: command not found
> ) $
> )
> ) I thought the idea for the shebang line was that my OS was going to
> ) interpret the script with perl. I do have a /usr/bin/perl, so I thought
> ) that typing perl1.pl at the prompt would be the same as typing perl
> ) perl1.pl, but manifestly, it is not. What gives?
>
> chmod +x perl1.pl
$ ./perl1.pl
> For more detail, ask in a unix froup.
Indeed.
Ben
------------------------------
Date: Wed, 31 Mar 2010 17:36:09 -0400
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <m27hosnph2.fsf@shermpendley.com>
Phred Phungus <Phred@example.invalid> writes:
> $ perl1.pl
> bash: perl1.pl: command not found
> $
>
> I thought the idea for the shebang line was that my OS was going to
> interpret the script with perl.
Yes, that's the idea.
> I do have a /usr/bin/perl
So? The error message doesn't say "/usr/bin/perl: command not found".
> What gives?
The "perl1.pl" command was not found in your command search path. You
need to specify the full path to it:
$ ./perl1.pl
sherm--
------------------------------
Date: Wed, 31 Mar 2010 17:37:05 -0400
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <m239zgnpfi.fsf@shermpendley.com>
Willem <willem@turtle.stack.nl> writes:
> Phred Phungus wrote:
> ) $ perl1.pl
> ) bash: perl1.pl: command not found
>
> chmod +x perl1.pl
That's not the error being reported above.
sherm--
------------------------------
Date: Wed, 31 Mar 2010 15:47:22 -0600
From: Phred Phungus <Phred@example.invalid>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <81hu7aFd6dU1@mid.individual.net>
Sherm Pendley wrote:
> Willem <willem@turtle.stack.nl> writes:
>
>> Phred Phungus wrote:
>> ) $ perl1.pl
>> ) bash: perl1.pl: command not found
>>
>> chmod +x perl1.pl
>
> That's not the error being reported above.
Sorry, newsgroup. I forgot the technique. It was in my own log for me
to read. :-(
$ chmod 700 perl1.pl
$ ./perl1.pl
Placido P. Octopus
Polypacido P. Octopus
Placido P. Octopus
Polypacido Polyp Octopus
$
Thanks all for replies.
--
fred
------------------------------
Date: Wed, 31 Mar 2010 16:00:46 -0600
From: Phred Phungus <Phred@example.invalid>
Subject: Re: FAQ 6.9 How can I quote a variable to use in a regex?
Message-Id: <81hv0fFhprU1@mid.individual.net>
Ben Morrow wrote:
> Quoth Phred Phungus <Phred@example.invalid>:
>> my $string2 = "Placido P. Octopus\n";
>> print $string2;
>> $string =~ s/$regex/Polyp/g;
> ^^^^^^^
>> print $string2;
> ^^^^^^^^
>
> One of these things is not like the other.
Yeah. It's funny the things a person thinks when he can't see an error
like this, which is, of course, no error at all. You spend a minute
thinking the output might be right, but then not only is Juergen wrong,
but no one else in c.l.p.misc calls him on it. That seemed unlikely.
Hence the need to post. A different set of eyes makes all the
difference. I don't know how it runs with other people, but I tend to
see what I'm looking for and could miss Lady Godiva riding right next to it.
One thing I like about this ng are the frequently-posted faq's.
--
fred
------------------------------
Date: Wed, 31 Mar 2010 02:26:45 -0700 (PDT)
From: salehh229 <salehh229@gmail.com>
Subject: Perl Errors
Message-Id: <28bffaaa-e4d0-4a9f-ad9e-dcfe92602c27@15g2000yqi.googlegroups.com>
I was running a perl script to generate a makefile and run into the
following errors:
======================================================================
Can't locate Getopt/Std.pm in @INC (@INC contains: C:\Program Files
\TeXLive\xemtex\perl\lib C:\Program Files\TeXLive\xemtex\perl\site
\lib .) at hjmkmf.pl line 32.
BEGIN failed--compilation aborted at hjmkmf.pl line 32.
======================================================================
I am working on windows xp with mingw and Tex/Latex by FPTex.
Any pointers on fixing the problem will be appreciated.
Please reply to
salehh229@gmail.com
Thank you.
------------------------------
Date: Wed, 31 Mar 2010 02:44:33 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Perl Errors
Message-Id: <9766r5h6r3mtt35hbprtrfgifgersvsqhj@4ax.com>
salehh229 <salehh229@gmail.com> wrote:
>I was running a perl script to generate a makefile and run into the
>following errors:
>
>Can't locate Getopt/Std.pm in @INC (@INC contains: C:\Program Files
>\TeXLive\xemtex\perl\lib C:\Program Files\TeXLive\xemtex\perl\site
>\lib .) at hjmkmf.pl line 32.
@INC is missing the pathes to your standard Perl libraries.
I would reinstall your whole Perl system, who knows what else is broken
with that installation.
>Please reply to
>
>salehh229@gmail.com
If you can post here you can read here.
jue
------------------------------
Date: Wed, 31 Mar 2010 12:28:22 +0000 (UTC)
From: "Keith R. Watson" <keith.watson@cc.gatech.edu>
Subject: Re: the mug of Perl
Message-Id: <hovf55$1lg$1@news-int.gatech.edu>
ccc31807 <cartercc@gmail.com> wrote in news:f63f9acd-ed20-4442-a1f1-
6b2cd6503179@8g2000yqz.googlegroups.com:
> http://nostarch.com/mugperl.htm
>
> cheat sheet is here:
>
> http://nostarch.com/mugperl_big.htm
>
> The cheat sheet appears to be targeted more to the casual user rather
> than to the daily grind. I wondering what would appear on a cheat
> sheet for journeymen Perlistas. My nomination would include the ||=
> operator.
>
> CC
This one is rather good.
Perl Reference Guide & Perl Pocket Reference
http://www.vromans.org/johan/perlref.html
At the bottom of the page is a link to the PDF version
http://www.squirrel.nl/pub/perlref-5.004.1.pdf
keith
--
Keith R. Watson Georgia Institute of Technology
Systems Support Specialist IV College of Computing
keith.watson@cc.gatech.edu 801 Atlantic Drive NW
(404) 385-7401 Atlanta, GA 30332-0280
------------------------------
Date: Wed, 31 Mar 2010 02:47:52 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: unary minus strangeness
Message-Id: <slrnhr5dup.gc4.nospam-abuse@powdermilk.math.berkeley.edu>
On 2010-03-30, Bo Lindbergh <blgl@hagernas.com> wrote:
> For real strangeness, you need to mix negative zero, boolean context,
> and stringification.
>
> {
> my $strange=-0.0;
> print $strange ? "$strange is true\n" : "$strange is false\n";
> print $strange ? "$strange is true\n" : "$strange is false\n";
> }
This is a bug. Read-only access should not change the value.
Yours,
Ilya
------------------------------
Date: Wed, 31 Mar 2010 04:01:10 -0700 (PDT)
From: Marc Girod <marc.girod@gmail.com>
Subject: Re: unary minus strangeness
Message-Id: <bb4830f5-b669-4701-9ed4-60036f71bb38@y17g2000yqd.googlegroups.com>
On Mar 28, 10:56=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
> For some reason, undef gets numified as a floating-point
> zero rather than an integral zero, so it can be negated.
May I check that I understand this with respect to the excerpt of
perlop John gave:
$ perl -E'say undef'
$ perl -E'say q()'
$ perl -E'say -undef'
-0
$ perl -E'say -q()'
0
$ perl -E'say "-undef"'
-undef
> If the operand is an identifier, a string consisting of a minus
> sign concatenated with the identifier is returned.
So, not this case:
undef is not an 'identifier', and the return is no '-undef'.
> Otherwise, if the string starts with a plus or minus,
> a string starting with the opposite sign is returned.
No.
> One effect of these rules is that -bareword is equivalent
> to the string "-bareword".
No.
> If, however, the string begins with a non-alphabetic character
> (excluding "+" or "-"), Perl will attempt to convert the
> string to a numeric and the arithmetic negation is performed.
I understand that this is what applies: undef is a 'non-alphabetic
character'?
There, undef is converted to 'floating-point 0', whereas q() (the
empty string) is converted to 'integer 0'.
> If the string cannot be cleanly converted to a numeric,
> Perl will give the warning
No: no warning.
Thanks,
Marc
------------------------------
Date: Wed, 31 Mar 2010 22:45:55 +0200
From: Bo Lindbergh <blgl@hagernas.com>
Subject: Re: unary minus strangeness
Message-Id: <hp0c9l$9cl$1@speranza.aioe.org>
In article <slrnhr5dup.gc4.nospam-abuse@powdermilk.math.berkeley.edu>,
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> On 2010-03-30, Bo Lindbergh <blgl@hagernas.com> wrote:
> > For real strangeness, you need to mix negative zero, boolean context,
> > and stringification.
> >
> > {
> > my $strange=-0.0;
> > print $strange ? "$strange is true\n" : "$strange is false\n";
> > print $strange ? "$strange is true\n" : "$strange is false\n";
> > }
>
> This is a bug. Read-only access should not change the value.
Would you call this example the same bug, a different bug, or not a bug?
{
my $strange="-0";
print "- $strange == ", -$strange, "\n";
my $ignored=0+$strange;
print "- $strange == ", -$strange, "\n";
}
Ditto for this one.
{
my($one,$two)=("12","21");
print "$one | $two == ", $one | $two, "\n";
my $ignored=$one+$two;
print "$one | $two == ", $one | $two, "\n";
}
/Bo Lindbergh
------------------------------
Date: Wed, 31 Mar 2010 22:08:31 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: unary minus strangeness
Message-Id: <f7qc87-0rp1.ln1@osiris.mauzo.dyndns.org>
Quoth Bo Lindbergh <blgl@hagernas.com>:
> In article <slrnhr5dup.gc4.nospam-abuse@powdermilk.math.berkeley.edu>,
> Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> > On 2010-03-30, Bo Lindbergh <blgl@hagernas.com> wrote:
> > > For real strangeness, you need to mix negative zero, boolean context,
> > > and stringification.
> > >
> > > {
> > > my $strange=-0.0;
> > > print $strange ? "$strange is true\n" : "$strange is false\n";
> > > print $strange ? "$strange is true\n" : "$strange is false\n";
> > > }
> >
> > This is a bug. Read-only access should not change the value.
>
> Would you call this example the same bug, a different bug, or not a bug?
> {
> my $strange="-0";
> print "- $strange == ", -$strange, "\n";
> my $ignored=0+$strange;
> print "- $strange == ", -$strange, "\n";
> }
That's not a bug, it's documented behaviour (at least, the "+0" output
is). Compare
my $s = "-foo"; say -$s;
0 + $s; say -$s;
Admittedly it's slightly *weird* behaviour, but there you go.
It probably is a bug that "-0" numifies as integer 0 without a warning,
since that's the stringification of -0.0. This is also a bug:
my $s = 0.0; say -$s;
0 + $s; say -$s;
but the problem here is that Perl needs to realise that even though
int(-0.0) == -0.0 they are not the same number, which is a little
confusing.
> Ditto for this one.
> {
> my($one,$two)=("12","21");
> print "$one | $two == ", $one | $two, "\n";
> my $ignored=$one+$two;
> print "$one | $two == ", $one | $two, "\n";
> }
That's a different bug. It's a design bug in the bitwise ops, it's
documented, and it cannot be fixed at this point due to compatibility.
Ben
------------------------------
Date: Wed, 31 Mar 2010 02:59:26 -0400
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: using Print << marker with require statement?
Message-Id: <m24ojxm0xd.fsf@shermpendley.com>
me <noemail@nothere.com> writes:
> A noob question about using a require statement. I tried including a
> file that looks like this:
>
> print << "endOfText";
> Sample Text
> endOfText
>
> This works fine in the main program but if I put it in a separate file
> and include it with a require statement, it fails with the message
> "Can't find string terminator "endOfText" anywhere before EOF at
> test-require.pl line 1.
>
> There must be some Perl subtlety that I am missing.
Perl chokes on here-docs that appear at the end of a file, if the file
does not end in a \n. Most text editors can be configured to add it for
you automagically.
sherm--
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 2897
***************************************