[28341] in Perl-Users-Digest
Perl-Users Digest, Issue: 9705 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 8 21:05:55 2006
Date: Fri, 8 Sep 2006 18:05:06 -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 Fri, 8 Sep 2006 Volume: 10 Number: 9705
Today's topics:
Re: $a and $b "reserved" for sort() <attn.steven.kuo@gmail.com>
Re: $a and $b "reserved" for sort() <mritty@gmail.com>
Re: $a and $b "reserved" for sort() <uri@stemsystems.com>
Re: $a and $b "reserved" for sort() <abigail@abigail.be>
Re: $a and $b "reserved" for sort() <hjp-usenet2@hjp.at>
Re: beginners question <xicheng@gmail.com>
Re: beginners question <abigail@abigail.be>
Re: beginners question <syscjm@gwu.edu>
Re: How system() & output works <tadmc@augustmail.com>
Integrate Compress::Zlib seamlessly w/no compression? peter.j.torelli@gmail.com
Re: PAR and pp <jl_post@hotmail.com>
Re: Pattern Matching and skipping <tadmc@augustmail.com>
Re: Pattern Matching and skipping <emschwar@pobox.com>
Re: perl script for apache mod_rewrite <tadmc@augustmail.com>
Re: rand() with less decimals. <tadmc@augustmail.com>
Re: rename file? open url? (newbie) <bik.mido@tiscalinet.it>
Re: rename file? open url? (newbie) <tintin@invalid.invalid>
Re: rename file? open url? (newbie) <tadmc@augustmail.com>
Re: User authentication for a website <mumia.w.18.spam+nospam.usenet@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Sep 2006 12:54:43 -0700
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: $a and $b "reserved" for sort()
Message-Id: <1157745283.847412.125480@p79g2000cwp.googlegroups.com>
Paul Lalli wrote:
> I confess that I've never understood this warning. Can someone please
> explain to me the danger of using $a or $b outside of a sort
> subroutine? Is it just a visual indicator to the programmer that we're
> worried about, or is there an actual danger of data being affected?
>
> $ perl -le'
> $a = "Hello";
> my $b = "World";
> my @vals = sort { length $a <=> length $b} qw(a bc alpha beta gamma);
> print "@vals";
> print "$a $b";
> '
> a bc beta alpha gamma
> Hello World
>
> Doesn't look to me like $a is being affected by sort. Presumably,
> sort() localizes the global value, and never touches the lexical at
> all. So what's the issue?
Your example produces no warnings or errors
but with this:
#!perl
use strict;
use warnings;
our $a;
my $b;
$a = 'foo';
$b = 'bar';
my @sorted = sort { $a <=> $b } (1, 5, 7, 6, 2, 3);
print $a, $b, "\n";
__END__
I see this error:
Can't use "my $b" in sort comparison at sor.pl line 11.
And with:
use strict;
use warnings;
our $a;
my $b;
$a = 'foo';
$b = 'bar';
my @sorted = sort { int($a) <=> int($b) } (1, 5, 7, 6, 2, 3);
print $a, $b, "\n";
__END__
I see a warning (but the proper output):
Argument "bar" isn't numeric in int at sor.pl line 11.
foobar
$ perl -v
This is perl, v5.8.7 built for i686-linux
...
--
Regards,
Steven
------------------------------
Date: 8 Sep 2006 13:03:33 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: $a and $b "reserved" for sort()
Message-Id: <1157745813.553335.186450@i42g2000cwa.googlegroups.com>
attn.steven.kuo@gmail.com wrote:
> Paul Lalli wrote:
>
> > $ perl -le'
> > $a = "Hello";
> > my $b = "World";
> > my @vals = sort { length $a <=> length $b} qw(a bc alpha beta gamma);
> > print "@vals";
> > print "$a $b";
> > '
> > a bc beta alpha gamma
> > Hello World
> >
> > Doesn't look to me like $a is being affected by sort. Presumably,
> > sort() localizes the global value, and never touches the lexical at
> > all. So what's the issue?
>
>
> Your example produces no warnings or errors
> but with this:
>
> #!perl
> use strict;
> use warnings;
>
> our $a;
> my $b;
>
> $a = 'foo';
> $b = 'bar';
>
> my @sorted = sort { $a <=> $b } (1, 5, 7, 6, 2, 3);
>
> print $a, $b, "\n";
>
> __END__
>
> I see this error:
>
> Can't use "my $b" in sort comparison at sor.pl line 11.
Well how about that. And here I thought I was being clever by using a
sort subroutine that couldn't just optimize away the $b, to make sure
it was "seen". Mental note: be less clever.
> And with:
>
> use strict;
> use warnings;
>
> our $a;
> my $b;
>
> $a = 'foo';
> $b = 'bar';
>
> my @sorted = sort { int($a) <=> int($b) } (1, 5, 7, 6, 2, 3);
>
> print $a, $b, "\n";
>
> __END__
>
> I see a warning (but the proper output):
>
> Argument "bar" isn't numeric in int at sor.pl line 11.
> foobar
Interesting. Okay, thank you very much for these examples. I have no
idea why mine generates no errors or warnings but these do, but at
least you've reaffirmed my belief in the "don't use $a or $b" mantra.
Thanks,
Paul Lalli
------------------------------
Date: Fri, 08 Sep 2006 16:05:29 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: $a and $b "reserved" for sort()
Message-Id: <x7zmdat986.fsf@mail.sysarch.com>
>>>>> "askc" == attn steven kuo@gmail com <attn.steven.kuo@gmail.com> writes:
askc> Paul Lalli wrote:
>> I confess that I've never understood this warning. Can someone please
>> explain to me the danger of using $a or $b outside of a sort
>> subroutine? Is it just a visual indicator to the programmer that we're
>> worried about, or is there an actual danger of data being affected?
askc> our $a;
askc> my $b;
askc> $a = 'foo';
askc> $b = 'bar';
askc> my @sorted = sort { $a <=> $b } (1, 5, 7, 6, 2, 3);
askc> Can't use "my $b" in sort comparison at sor.pl line 11.
askc> our $a;
askc> my $b;
askc> $a = 'foo';
askc> $b = 'bar';
askc> my @sorted = sort { int($a) <=> int($b) } (1, 5, 7, 6, 2, 3);
askc> print $a, $b, "\n";
askc> I see a warning (but the proper output):
askc> Argument "bar" isn't numeric in int at sor.pl line 11.
askc> foobar
and the other way is also an issue. $a and $b are immune to strict
warnings since they are global and used by sort(). requiring them to be
declared in sort callback subs and such would be a pain.
perl -Mstrict -e '$a = $b'
perl -Mstrict -e '$a = $c'
Global symbol "$c" requires explicit package name at -e line 1.
so for both the global nature of $a and $b and for being immune to
strict, it is not a good idea to use those vars outside sort code.
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: 08 Sep 2006 20:38:51 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: $a and $b "reserved" for sort()
Message-Id: <slrneg3l6r.d0.abigail@alexandra.abigail.be>
Uri Guttman (uri@stemsystems.com) wrote on MMMMDCCLVI September MCMXCIII
in <URL:news:x7zmdat986.fsf@mail.sysarch.com>:
%%
%% and the other way is also an issue. $a and $b are immune to strict
%% warnings since they are global and used by sort(). requiring them to be
%% declared in sort callback subs and such would be a pain.
That's not the reason.
The fact that $a and $b are special is a matter of the implementation
(to be more exact, a dirty optimization) leaking out into the language
proper. Sort subs are nasty, they aren't called like normal functions.
Instead, Perl pokes in the subs internals, and then just runs the code.
%% perl -Mstrict -e '$a = $b'
%% perl -Mstrict -e '$a = $c'
%% Global symbol "$c" requires explicit package name at -e line 1.
%%
%% so for both the global nature of $a and $b and for being immune to
%% strict, it is not a good idea to use those vars outside sort code.
You know, there are all kinds of reasons not to use '$a' and '$b', and
while the above is true, it's just a minor issue.
If your program is a small throw away program, noone really cares about
your variable names. And using $a and $b will probably just work fine.
And if you have a large program, the most important reason not to use
$a and $b as variables *ISN'T* the issue with sort. It's the same reason
why using $c and $d should be avoided: the names are neither descriptive,
nor idiomatic.
I use $a and $b all the time in short programs, and, except for $i, $j, $k,
$n, $m, $x, $y and $z as indices, I don't use single letter variables in
larger programs.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: Fri, 8 Sep 2006 22:43:09 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: $a and $b "reserved" for sort()
Message-Id: <slrneg3lf3.m8r.hjp-usenet2@yoyo.hjp.at>
On 2006-09-08 18:03, Paul Lalli <mritty@gmail.com> wrote:
> I confess that I've never understood this warning. Can someone please
> explain to me the danger of using $a or $b outside of a sort
> subroutine? Is it just a visual indicator to the programmer that we're
> worried about, or is there an actual danger of data being affected?
>
> $ perl -le'
> $a = "Hello";
> my $b = "World";
^^^^^
> my @vals = sort { length $a <=> length $b} qw(a bc alpha beta gamma);
^^
> print "@vals";
> print "$a $b";
> '
> a bc beta alpha gamma
> Hello World
Hmm, for me (v5.8.4 built for i386-linux-thread-multi and v5.8.8 built
for i686-linux) this prints
bc alpha beta gamma
Hello World
which is not the correct sort order.
> Doesn't look to me like $a is being affected by sort. Presumably,
> sort() localizes the global value, and never touches the lexical at
> all.
Yes, but the comparison routine will access the lexical variable $b and not
the global which is localized by sort. Change the line "my @vals ..." to
my @vals = sort {
print "comparing $a and $b\n";
length $a <=> length $b
} qw(a bc alpha beta gamma);
and run the code again: It will print:
comparing a and World
comparing alpha and World
comparing a and World
comparing alpha and World
comparing a and World
comparing gamma and World
comparing gamma and World
comparing gamma and World
a bc alpha beta gamma
Hello World
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: 8 Sep 2006 11:17:31 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: beginners question
Message-Id: <1157739451.298738.88660@m73g2000cwd.googlegroups.com>
Brian McCauley wrote:
> Xicheng Jia wrote:
>
> > $string =~ s/(?!.* String).*//;
>
> Did you benchamark that?
Please be patient, I never said that it's an efficient way, just one
possible alternative, that's it.
--
XC
------------------------------
Date: 08 Sep 2006 20:26:59 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: beginners question
Message-Id: <slrneg3kgj.d0.abigail@alexandra.abigail.be>
Chris Mattern (syscjm@gwu.edu) wrote on MMMMDCCLVI September MCMXCIII in
<URL:news:12g3547tib5nga5@corp.supernews.com>:
//
// Seems to be making it unnecessarily complex. You can do this
// without any backtracking at all, and keeping the RE dead
// simple (but note, untested):
//
// $findstring = "Test"; # or "String", or whatever you're looking for
//
// if ($str =~ /(.*)$findstring/) {
This will backtrack as well.
Abigail
--
use lib sub {($\) = split /\./ => pop; print $"};
eval "use Just" || eval "use another" || eval "use Perl" || eval "use Hacker";
------------------------------
Date: Fri, 08 Sep 2006 17:14:54 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: beginners question
Message-Id: <12g3nahklckke02@corp.supernews.com>
Abigail wrote:
> Chris Mattern (syscjm@gwu.edu) wrote on MMMMDCCLVI September MCMXCIII in
> <URL:news:12g3547tib5nga5@corp.supernews.com>:
> //
> // Seems to be making it unnecessarily complex. You can do this
> // without any backtracking at all, and keeping the RE dead
> // simple (but note, untested):
> //
> // $findstring = "Test"; # or "String", or whatever you're looking for
> //
> // if ($str =~ /(.*)$findstring/) {
>
>
> This will backtrack as well.
>
>
Pardon me, you're right, of course. What I meant to say was you don't
have to put in lookahead and lookbehind.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Fri, 8 Sep 2006 18:04:35 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How system() & output works
Message-Id: <slrneg3to3.j5b.tadmc@magna.augustmail.com>
Brian McCauley <nobull67@gmail.com> wrote:
> mingclee1@gmail.com wrote:
>
>> I am running into a weird problem:
>
> [ snip output buffering problem ]
>
> See FAQ: "How do I flush/unbuffer an output filehandle? Why must I do
> this?"
>
See also:
Suffering from Buffering?
http://perl.plover.com/FAQs/Buffering.html
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 8 Sep 2006 13:00:41 -0700
From: peter.j.torelli@gmail.com
Subject: Integrate Compress::Zlib seamlessly w/no compression?
Message-Id: <1157745641.539097.116200@d34g2000cwd.googlegroups.com>
Hello,
I use Compress::Zlib extensively for reading files, but I always run
into this problem when writing:
If the user does not want to write compressed output, I can't use
Compress::Zlib for writing. I tried all the Zlib options to turn off
compression, and it always inserts a binary header, even with no
compression.
Since the read/write/close methods for the object are not the same as
an uncompressed filehandle, I can't just use a different open method
for the same variable. Instead I end up having to use open() and a
pipe to gzip if compression is desired so that the same filehandle can
be used without a ton of conditionals in the code.
So the simple question is: how do I turn off all compression and
headers when I use gzopen() and just write a plain text file?
(Note: I already played with Compress::Zlib::Z_NO_COMPRESSION, and
-WindowBits=>-MAX_WBITS, as well as "w" vs. "wb".)
Thanks,
Peter
------------------------------
Date: 8 Sep 2006 13:41:43 -0700
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: PAR and pp
Message-Id: <1157748102.984964.315010@e3g2000cwe.googlegroups.com>
Jakanapes wrote:
>
> I'm using Activeperl 5.8.8.819 and tried using PAR .952, however from
> the command line, I'm getting "'pp' is not recognized as an internal or
> external command..."
>
> What might I be missing?
It's hard to say for sure, but are you sure you installed PAR? If
you aren't sure, this command will install it for you (it will let you
know if it's already installed):
ppm install PAR
If it complains that the Module::ScanDeps module is missing, you can
easily install it with the command:
ppm install Module-ScanDeps
Once installation is successful, see if you can compile scripts. If
you still can't, I would think that the "pp.bat" file you need isn't in
your %PATH% environment variable.
To verify this, go to your Perl's bin directory (it might be
"C:\Perl\bin") and look for a file named "pp.bat". Is it there? If it
is, then you probably don't have the Perl bin directory in your %PATH%.
Type "echo %PATH%" to see the directories in your path to verify that
the directory is indeed not in your path. If it really isn't in your
path, then you must add it. There are different ways of adding it to
your path (some of which depend on your flavor of Windows), so you
don't know how to do it, you'll have to search around and see how to do
it for your particular OS.
If, on the other hand, the "pp.bat" file isn't in Perl's bin
directory, then PAR probably didn't install correctly. You might want
to "Search" your hard drive(s) for the "pp.bat" file in case it was
copied to the wrong place.
It's kind of hard to troubleshoot this problem remotely, so this is
all the advice I can give you for now. I hope it helps.
-- Jean-Luc
--
perl -le "print(pack'B*','0'.unpack'B*',pack'w*',
5592691776,37562575106519616,8746773568,354130435682904)"
------------------------------
Date: Fri, 8 Sep 2006 17:56:44 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Pattern Matching and skipping
Message-Id: <slrneg3t9c.j5b.tadmc@magna.augustmail.com>
MattJ83 <mattjones@hotmail.co.uk> wrote:
>
>> If you post a SHORT AND COMPLETE PROGRAM THAT WE CAN RUN, then
>> we can surely help you.
>>
>> Try doing that for once.
>
> ok, sorry.
>
> #!/usr/central/bin/perl
> use strict;
> #use warnings;
You lose all of "use warnings" benefits if you comment it out.
> use DBI;
>
> my @filenames= </home/username/logs/*.log>;
> foreach my $filename (@filenames) {
> open my $LOG, '<', $filename or die "can't open $filename: $!\n";
>
> while (<$LOG>) {
> if (/updates table/) {
> my $info = $_;
> {
> while (<$LOG>) {
> if (/elapsed/) {
> my $elapsed1 = $_;
> {
> while (<$LOG>) {
> if (/conflicting|FASTSEARCH/) {
> my $fast = $_;
> {
> while (<$LOG>) {
> if (/elapsed/) {
> my $elapsed2 = $_;
> {
I'm pretty sure I said this already:
Read the line once, test it many times.
So why are you reading the lines 4 times instead of once?
[snip]
> }}}}}}}}}}}}}
I have never seen a line of Perl code like that in my 12 years
of Perl programming. It is a sure sign of some conceptual error
on your part.
You need to understand what you are doing, not just try random stuff...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 08 Sep 2006 11:31:49 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Pattern Matching and skipping
Message-Id: <874pvi2rju.fsf@localhost.localdomain>
"MattJ83" <mattjones@hotmail.co.uk> writes:
> > If you post a SHORT AND COMPLETE PROGRAM THAT WE CAN RUN, then
> > we can surely help you.
> >
> > Try doing that for once.
>
> ok, sorry.
Problem is, your code, as posted, relies on a database we don't know
about, and don't really want to set up anyway. So we can't run the
program, even if we wanted to. Also, you can put your data in your
program, after a __DATA__ literal, and read it with the predefined
DATA filehandle. perldoc perldata for more on this (see: "Special
Literals").
> #!/usr/central/bin/perl
> use strict;
> #use warnings;
You should uncomment this line. If you don't know how to get rid of
the warnings it produces, then ask here, and we can help. But with it
off, you're basically asking us to help you find problems that
warnings can uncover for you. In other words, you're communicating to
us (whether you mean to or not) that our time is less important than
your computers'.
> use DBI;
But, we don't have a database set up. So this makes it too hard to
use. Anyway, you just need to replace your database inserts with
print statements to make it easy to use.
> my @filenames= </home/username/logs/*.log>;
> foreach my $filename (@filenames) {
> open my $LOG, '<', $filename or die "can't open $filename: $!\n";
>
> while (<$LOG>) {
> if (/updates table/) {
> my $info = $_;
> {
> while (<$LOG>) {
This right here is, well, not to put too fine a point on it, dumb.
You already have a loop over the data. Logically, it's confusing to
start a new loop inside the old one. The usual problem is that when
the next iteration of the outer while() begins, the default assumption
is that it will read the next line after the previous iteration.
Putting another while loop inside it destroys that assumption, and
confuses debuggers to no end. This is very bad style; if you worked
for me, I wouldn't accept it, because the next person to look at your
code would be horribly confused.
Because of the way you've done it, you won't see that effect, but it's
more of an accident than anything else. You definitely should not use
this anywhere else; most of the people responding to you are trying to
communicate that this is a bad and confusing idea.
You don't need to start a brand-new while loop anyway; what your code
says is that you only look for "elapsed" after you find "updates
table", and you only look for "conflicting" or "FASTSEARCH" after you
find "elapsed". If this is the case, you can just do something like:
#/usr/bin/perl
use warnings;
use strict;
my ($info, $elapsed1, $fast, $elapsed2);
while(<DATA>) {
chomp;
if (/updates table/) {
print "found updates: [$_]\n";
$info = $_;
}
if (/elapsed/) {
print "found elapsed: [$_]... ";
if ($fast) {
print "setting elapsed2\n";
$elapsed2 = $_;
last;
} elsif ($info) {
print "setting elapsed1\n";
$elapsed1 = $_;
}
}
if (/conflicting|FASTSEARCH/) {
print "found fast: [$_]\n";
$fast = $_;
}
}
# do db stuff here for real
print "info: [$info] fast: [$fast] ".
"elapsed1: [$elapsed1] elapsed2: [$elapsed2]\n";
__DATA__
Text updates table text
text
text elapsed text
text
FASTSEARCH text text
text elapsed
text
__END__
Notice how I only loop over it once. Each time I find a line I might
be interested in, I check to see if I really am-- in the case of
finding "elapsed", you may want to set $elapsed1 or $elapsed2, so you
have to check if $fast or $info are set to determine which one to set.
> $dbh->do("insert into LOGS values ('$filename', '$info', '$elapsed1',
> '$fast', '$elapsed2')")
> or die ("inserting data failure: $!\n");
Ugh, don't do that. Let DBI escape all the values for you. What if,
for instance, $filename contained the string
a', 'b', 'c', 'd', 'e'); delete from LOGS;
? Then your statement would look like:
$dbh->do("insert into LOGS values ('a', 'b', 'c', 'd', 'e'); delete from LOGS");
That's only the easiest way to screw you up; there are far nastier and
subtler ways to cause problems. Also, and this is NOT a Perl problem,
but since I'm feeling generous, I'll point it out anyway: you should
always list the columns when you do an insert, because (A) it's easier
to see what's going on when you read the code (you can look at it and
know what goes where) and (B) if the order of the fields ever changes,
you're screwed, and you don't know why.
Instead of trying to put in quote marks yourself, let DBI do it for
you with placeholders:
$dbh->do("INSERT INTO LOG (filename, info, start, fast, end)
VALUES (?, ?, ?, ?, ?)", undef,
$filename, $info, $elapsed1, $fast, $elapsed2);
perldoc DBI, and look for "Placeholders and Bind Values" to learn more.
> $dbh->disconnect;
> }}}}}}}}}}}}}
Ugh. This is butt-ugly. You can't tell by looking at this line which
brace corresponds to which if or while statement. If you wanted to
change the code later, you'll pretty much have to keep running it
until you get rid of all the syntax errors, instead of reading the
code to see what goes where. And even then, you're likely to put
something in the wrong place.
> exit;
>
> .log
> Text updates table text
> text
> text elapsed text
> text
> FASTSEARCH text text
> text elapsed
> text
>
> If you make multiple copies of this log file and remove the word
> FASTSEARCH from one of the logs - the log will not be placed into the
> database.
That's what your code says to do-- if you don't find FASTSEARCH, you
don't get to the part that updates the database. Isn't that what you
wanted? I'm not sure, based on your posts here, that you're entirely
clear on what it is you're trying to do here.
-=Eric
------------------------------
Date: Fri, 8 Sep 2006 18:06:54 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: perl script for apache mod_rewrite
Message-Id: <slrneg3tse.j5b.tadmc@magna.augustmail.com>
Aaron Haspel <ahaspel@gmail.com> wrote:
> $|=1; # Turn off buffering
That does not turn off buffering you know.
$| = 1; # Enable auto-flush
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 8 Sep 2006 17:58:17 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: rand() with less decimals.
Message-Id: <slrneg3tc9.j5b.tadmc@magna.augustmail.com>
Olaf <olaf_el_blanco@gmail.es> wrote:
> I need that $a have just two decimals and not 14!
perldoc -q round
Does Perl have a round() function? What about ceil() and floor()?
Trig functions?
> (My perl is correctly compiled)
Ummm, OK.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 8 Sep 2006 20:31:37 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: rename file? open url? (newbie)
Message-Id: <hkd3g2lusbgg9sumqs9gcb83ttah7d8745@4ax.com>
On 8 Sep 2006 07:53:58 -0700, aotemp@hotmail.com wrote:
>Im working with perl, just a very very little bit, and Im looking for
>help on how to do 2 tasks.
Then it would be better to ask two different questions in two
different threads
>Im trying to rename, or copy and rename a file stored in my directory,
Hmmm... how the hell a rename() function may ever be called?!?
;-)
>and Im trying to redirect my user to another url.
This is a group for discussing Perl. How is this a Perl related
question?
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: Sat, 9 Sep 2006 09:22:08 +1200
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: rename file? open url? (newbie)
Message-Id: <4501d1e3$0$19655$88260bb3@free.teranews.com>
<aotemp@hotmail.com> wrote in message
news:1157727238.555006.67530@m79g2000cwm.googlegroups.com...
> Hi!
>
> Im working with perl, just a very very little bit, and Im looking for
> help on how to do 2 tasks.
>
> Im trying to rename, or copy and rename a file stored in my directory,
> and Im trying to redirect my user to another url.
>
> ANy advice is appreciated!
I was very tempted to add your question to the Perl SAQ
(http://www.ginini.com/perlsaq.html), but I'm feeling generous today and
give you a second chance to discover the Perl documentation for rename.
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: Fri, 8 Sep 2006 18:18:51 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: rename file? open url? (newbie)
Message-Id: <slrneg3uir.j5b.tadmc@magna.augustmail.com>
aotemp@hotmail.com <aotemp@hotmail.com> wrote:
> Im working with perl, just a very very little bit, and Im looking for
> help on how to do 2 tasks.
You should look for help on Usenet *last*.
You should look for help first in the documentation for
the software that you are using.
> Im trying to rename,
perldoc -f rename
> and Im trying to redirect my user to another url.
perldoc -q redirect
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 08 Sep 2006 19:46:23 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: User authentication for a website
Message-Id: <jMjMg.9103$xQ1.1032@newsread3.news.pas.earthlink.net>
On 09/08/2006 07:27 AM, sujay.tukai@gmail.com wrote:
> I have an account in a website. Whenever i need to read my inbox from
> that website. I have to login with my name and password.
>
> I need a solution for this i.e.,
> i need a perl program which
>
> (1)uses the password and username to login
> (2) read the inbox
> [...]
Someone may have already written a module for that. Search
CPAN for "webmail."
------------------------------
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 V10 Issue 9705
***************************************