[31285] in Perl-Users-Digest
Perl-Users Digest, Issue: 2530 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 31 16:08:48 2009
Date: Fri, 31 Jul 2009 13:08:29 -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, 31 Jul 2009 Volume: 11 Number: 2530
Today's topics:
Re: FAQ 7.13 What's a closure? <RjY@sp.am>
Re: FAQ 7.13 What's a closure? <brian.d.foy@gmail.com>
Re: FAQ 7.13 What's a closure? <uri@stemsystems.com>
Re: FAQ 7.13 What's a closure? <RjY@sp.am>
forcing FTP timeouts? <bugbear@trim_papermule.co.uk_trim>
Re: forcing FTP timeouts? <smallpond@juno.com>
Re: forcing FTP timeouts? <xhoster@gmail.com>
Re: forcing FTP timeouts? <bugbear@trim_papermule.co.uk_trim>
Re: forcing FTP timeouts? <bugbear@trim_papermule.co.uk_trim>
Guessing Encodings and the PerlIO layer sln@netherlands.com
Re: Guessing Encodings and the PerlIO layer <someone@example.com>
Re: Guessing Encodings and the PerlIO layer sln@netherlands.com
I've bought a passwords to porno video sites and want t xpost@mailinator.com
lwp::simple and rget--can I compare <bdy120602@gmail.com>
Re: lwp::simple and rget--can I compare <tadmc@seesig.invalid>
Re: lwp::simple and rget--can I compare <bdy120602@gmail.com>
Re: lwp::simple and rget--can I compare <tadmc@seesig.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 29 Jul 2009 20:03:08 GMT
From: RjY <RjY@sp.am>
Subject: Re: FAQ 7.13 What's a closure?
Message-Id: <0W1cm.109905$e11.28530@newsfe14.ams2>
PerlFAQ Server posted:
> Note that some languages provide anonymous functions but are not capable
> of providing proper closures: the Python language, for example.
I don't want to start off a language war but isn't this information out
of date?
> sub make_adder {
> my $addpiece = shift;
> return sub { shift() + $addpiece };
> }
>
> $f1 = make_adder(20);
> $f2 = make_adder(555);
def make_adder(addpiece):
def adder(n):
return addpiece + n
return adder
f1 = make_adder(20)
f2 = make_adder(555)
--
http://rjy.org.uk/
------------------------------
Date: Wed, 29 Jul 2009 16:55:14 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 7.13 What's a closure?
Message-Id: <290720091655140121%brian.d.foy@gmail.com>
In article <0W1cm.109905$e11.28530@newsfe14.ams2>, RjY <RjY@sp.am>
wrote:
> PerlFAQ Server posted:
> > Note that some languages provide anonymous functions but are not capable
> > of providing proper closures: the Python language, for example.
>
> I don't want to start off a language war but isn't this information out
> of date?
It is probably out-of-date, but also probably using a different
definition. It's not really useful to the answer in the Perl FAQ, so I
just deleted that part.
Thanks,
------------------------------
Date: Wed, 29 Jul 2009 18:05:36 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: FAQ 7.13 What's a closure?
Message-Id: <87r5vzp2kv.fsf@quad.sysarch.com>
>>>>> "R" == RjY <RjY@sp.am> writes:
R> PerlFAQ Server posted:
>> Note that some languages provide anonymous functions but are not capable
>> of providing proper closures: the Python language, for example.
R> I don't want to start off a language war but isn't this information out
R> of date?
>> sub make_adder {
>> my $addpiece = shift;
>> return sub { shift() + $addpiece };
>> }
>>
>> $f1 = make_adder(20);
>> $f2 = make_adder(555);
R> def make_adder(addpiece):
R> def adder(n):
R> return addpiece + n
R> return adder
R> f1 = make_adder(20)
R> f2 = make_adder(555)
i am not a python expert (or even a newbie, thankfully!) but a quick
google found this little nugget:
Caveats
In some languages, the variable bindings contained in a closure
behave just like any other variables. Alas, in python they are
read-only. This is similar to Java, and has the same solution:
closing container objects. Closure of a dictionary or array
won't let you assign a new dictionary or array, but will let you
change the contents of the container. This is a common use
pattern - every time you set a variable on self, you are
changing the contents of a closed dictionary.
with perl's closures (and with other langs that fully support them) you
can do this:
sub make_up_down_counter {
my $counter ;
return sub { $counter }, sub { $counter++ }, sub { $counter-- } ;
}
my( $get_counter, $up_count, $down_down ) = make_up_down_counter() ;
and you can do that multiple times and only those 3 returned subs can
access their shared counter (they are all closed over it). using a hash
ref for that seems to be one python solution but that is overkill when
all you need to close over is a scalar. other pages comment on how
python doesn't really have anon subs but a clumsy lambda thing. and
others comment that using named subs for this works but is clumsy.
maybe the faq shouldn't mention python here but it is correct in that
doesn't seem to have true closures as other dynamic langs do. wierd
workarounds with limitations don't count.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 30 Jul 2009 01:04:10 GMT
From: RjY <RjY@sp.am>
Subject: Re: FAQ 7.13 What's a closure?
Message-Id: <ek6cm.125607$tU4.99217@newsfe19.ams2>
Uri Guttman posted:
>maybe the faq shouldn't mention python here but it is correct in that
>doesn't seem to have true closures as other dynamic langs do. wierd
>workarounds with limitations don't count.
Thanks for the explanation - it's clearly a more subtle issue than I had
considered.
--
http://rjy.org.uk/
------------------------------
Date: Thu, 30 Jul 2009 15:51:01 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: forcing FTP timeouts?
Message-Id: <38qdnZy6xczILuzXnZ2dnUVZ8g2dnZ2d@brightview.co.uk>
I'm trying to write some robust remote delivery code.
I'm using Net::FTP as a ftp client.
Can anyone suggest a way to persuade the FTP server
to slow down/stop to that I get a timeout?
I'd like to test my codes behaviour under adverse conditions.'
BugBear
------------------------------
Date: Thu, 30 Jul 2009 14:37:29 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: forcing FTP timeouts?
Message-Id: <67f85484-d408-4f09-8aaa-bd5df758316f@k6g2000yqn.googlegroups.com>
On Jul 30, 10:51=A0am, bugbear <bugbear@trim_papermule.co.uk_trim>
wrote:
> I'm trying to write some robust remote delivery code.
>
> I'm using Net::FTP as a ftp client.
>
> Can anyone suggest a way to persuade the FTP server
> to slow down/stop to that I get a timeout?
>
Run the ftp server in a debugger and hit stop.
> I'd like to test my codes behaviour under adverse conditions.'
Try Fargo in February.
------------------------------
Date: Thu, 30 Jul 2009 20:08:09 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: forcing FTP timeouts?
Message-Id: <4a728c97$1$25850$ed362ca5@nr5-q3a.newsreader.com>
bugbear wrote:
> I'm trying to write some robust remote delivery code.
>
> I'm using Net::FTP as a ftp client.
>
> Can anyone suggest a way to persuade the FTP server
> to slow down/stop to that I get a timeout?
On unixy systems, Get the servers pid and then smack it with a STOP.
kill -STOP <pid>
Or if you are running the server from the command line, rather than the
normal daemon, just hit ctrl-Z (however, that works by sending a TSTP,
which is blockable if the ftp server is stubborn. STOP is not blockable)
Xho
------------------------------
Date: Fri, 31 Jul 2009 09:29:18 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: forcing FTP timeouts?
Message-Id: <QNGdnbKlt6zDNu_XnZ2dnUVZ8r5i4p2d@brightview.co.uk>
Xho Jingleheimerschmidt wrote:
> bugbear wrote:
>> I'm trying to write some robust remote delivery code.
>>
>> I'm using Net::FTP as a ftp client.
>>
>> Can anyone suggest a way to persuade the FTP server
>> to slow down/stop to that I get a timeout?
>
> On unixy systems, Get the servers pid and then smack it with a STOP.
>
> kill -STOP <pid>
>
> Or if you are running the server from the command line, rather than the
> normal daemon, just hit ctrl-Z (however, that works by sending a TSTP,
> which is blockable if the ftp server is stubborn. STOP is not blockable)
Simple, easy and effective. Thank you!
BugBear (ashamed not to have thought of that)
------------------------------
Date: Fri, 31 Jul 2009 16:53:07 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: forcing FTP timeouts?
Message-Id: <GOSdnTBWktr-ju7XnZ2dnUVZ8hNi4p2d@brightview.co.uk>
bugbear wrote:
> Xho Jingleheimerschmidt wrote:
>> bugbear wrote:
>>> I'm trying to write some robust remote delivery code.
>>>
>>> I'm using Net::FTP as a ftp client.
>>>
>>> Can anyone suggest a way to persuade the FTP server
>>> to slow down/stop to that I get a timeout?
>>
>> On unixy systems, Get the servers pid and then smack it with a STOP.
>>
>> kill -STOP <pid>
>>
>> Or if you are running the server from the command line, rather than
>> the normal daemon, just hit ctrl-Z (however, that works by sending a
>> TSTP, which is blockable if the ftp server is stubborn. STOP is not
>> blockable)
>
> Simple, easy and effective. Thank you!
Note for anyone else doing the same thing.
The timeout number in Net::FTP is per packet; when doing a bulk
data transfer with the default 10k block/packet size, you can
be well within the default 2 minute timeout per packet,
and still have your transfer take "longer than you hoped"
If you want a per-file timeout, you have to do it yourself.
BugBear (off to code a timeout!)
------------------------------
Date: Sun, 26 Jul 2009 18:22:15 -0700
From: sln@netherlands.com
Subject: Guessing Encodings and the PerlIO layer
Message-Id: <mdsp65dt5npjo118eog51btuqgfk8ipiss@4ax.com>
Hi, this subject has probably been hashed over.
Maybe someone can steer me in the right direction.
If I could actually get un-alterred data from the first
4 bytes of data from a file I could check this myself
(UTF and BOM is all I care about).
And I can get byte data if the file hasn't had an encoding
translation added to the PerlIO layer. It seems that even
sysread bytes, in that case are decoded (if a layer is specified
at open time, or via binmode).
I've got a module that recieves a file handle and starts to work on
data. If there is no encoding layer associated with the file handle,
byte data is returned (the Perl default). If there is an encoding,
PerlIO converts the data (for example, a read) to the default utf8
via the Encode layer.
I thought file handles were now PerlIO objects but I can't find
any documentation on methods, that maybe could help me to find out
info on attached (en/de)coding layers. And maybe possibly manipulate
(temporarily) the layer interactions.
Its probable that many files are opened and passed to my module.
Its also most likely they are NOT opened with any particular encoding
layer specified. As a result, some files are more than likely UTF-16/32,
and will bomb as my module process the data.
I really only care about files that are of UTF encodings. All others
are exotic and left up to the caller to specify a layer.
I tried alot of stuff but had to settle on Encode::Guess. Apparently,
Encode and its flavors control the conversions and ANY encoding specified
in the IO layer will convert to utf8, which is ok but its pretty tough
to standardize a regex containing FFFE bytes to file data utf8.
The problem is the files BOM is encoded out via utf8 (encode layer)
then balks at the regex FFFE bytes. I would have to encode both to a
new encoding like UTF-32 for example:
$fileBOMdata = decode("UTF-32", pack 'L*', (BOM32, map {ord $_} split //, $fileBOMdata));
$regexLEdata = decode("UTF-32", pack 'L*', (BOM32, map {ord $_} split //, "\x{ff}\x{fe}"));
$regexBEdata = decode("UTF-32", pack 'L*', (BOM32, map {ord $_} split //, "\x{fe}\x{ff}"));
$fileBOMdata =~ /^$regexLEdata(\x{0}\x{0}|)?/ or /^(\x{0}\x{0}|)?$regexBEdata/
etc ...
But I think Encode gets to use byte data thus avoiding all this stuff.
So, here is what I got working. A snippet, verbose and not trimmed yet.
If there is another way please let me know.
-sln
#############
open my $fh, "<:encoding(UTF-16)", $fname or die "can't open $fname...";
# open my $fh, $fname or die "can't open $fname...";
# binmode ($fh, ":encoding(UTF-16)");
seek ($fh, 0, 0);
# UTF-8/16/32 check
print STDERR "UTF Check: ";
my $bomdata = '';
my $number_read = sysread ($fh, $bomdata, 4, 0);
seek ($fh, 0, 0);
if (defined $number_read and $number_read > 0)
{
use Encode::Guess;
# test 'guess' behavior ..
#$bomdata = "\x{ff}\x{fe}\x{0}\x{0}";
#$bomdata = "\x{fe}\x{ff}\x{0}\x{0}";
#$bomdata = "\x{0}\x{0}\x{ff}\x{ff}";
#$bomdata = "\x{4f}";
#$bomdata = "\x{8f}";
my $decoder = guess_encoding ( $bomdata ); # ascii/utf8/BOMed UTF
if (ref($decoder)) {
my $name = $decoder->name;
print STDERR "guess $name";
if ($name =~ /UTF.*?(?:16|32)/i) {
print STDERR " (not utf8). Adding this layer.\n";
binmode ($fh, ":encoding($name)");
} else {
print STDERR ". Not adding this layer.\n";
}
} else {
print STDERR "$decoder\n";
}
} else {
print STDERR "utf8 or file is empty\n";
}
#############
------------------------------
Date: Mon, 27 Jul 2009 01:25:08 -0700
From: "John W. Krahn" <someone@example.com>
Subject: Re: Guessing Encodings and the PerlIO layer
Message-Id: <Evdbm.17423$8B7.11370@newsfe20.iad>
sln@netherlands.com wrote:
> Hi, this subject has probably been hashed over.
> Maybe someone can steer me in the right direction.
>
> If I could actually get un-alterred data from the first
> 4 bytes of data from a file I could check this myself
> (UTF and BOM is all I care about).
>
> And I can get byte data if the file hasn't had an encoding
> translation added to the PerlIO layer. It seems that even
> sysread bytes, in that case are decoded (if a layer is specified
> at open time, or via binmode).
>
> I've got a module that recieves a file handle and starts to work on
> data. If there is no encoding layer associated with the file handle,
> byte data is returned (the Perl default). If there is an encoding,
> PerlIO converts the data (for example, a read) to the default utf8
> via the Encode layer.
>
> I thought file handles were now PerlIO objects but I can't find
> any documentation on methods, that maybe could help me to find out
> info on attached (en/de)coding layers.
perldoc PerlIO
[ SNIP ]
Querying the layers of filehandles
The following returns the names of the PerlIO layers on a
filehandle.
my @layers = PerlIO::get_layers($fh); # Or FH, *FH, "FH".
> And maybe possibly manipulate (temporarily) the layer interactions.
perldoc PerlIO
[ SNIP ]
:pop
A pseudo layer that removes the top-most layer. Gives perl
code a way to manipulate the layer stack.
John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov
------------------------------
Date: Mon, 27 Jul 2009 19:38:36 -0700
From: sln@netherlands.com
Subject: Re: Guessing Encodings and the PerlIO layer
Message-Id: <iens659dojkj0vchoi4qurj8cluj5epj42@4ax.com>
On Mon, 27 Jul 2009 01:25:08 -0700, "John W. Krahn" <someone@example.com> wrote:
>sln@netherlands.com wrote:
>> Hi, this subject has probably been hashed over.
>> Maybe someone can steer me in the right direction.
>>
>> If I could actually get un-alterred data from the first
>> 4 bytes of data from a file I could check this myself
>> (UTF and BOM is all I care about).
>>
>> And I can get byte data if the file hasn't had an encoding
>> translation added to the PerlIO layer. It seems that even
>> sysread bytes, in that case are decoded (if a layer is specified
>> at open time, or via binmode).
>>
>> I've got a module that recieves a file handle and starts to work on
>> data. If there is no encoding layer associated with the file handle,
>> byte data is returned (the Perl default). If there is an encoding,
>> PerlIO converts the data (for example, a read) to the default utf8
>> via the Encode layer.
>>
>> I thought file handles were now PerlIO objects but I can't find
>> any documentation on methods, that maybe could help me to find out
>> info on attached (en/de)coding layers.
>
>perldoc PerlIO
>[ SNIP ]
> Querying the layers of filehandles
>
> The following returns the names of the PerlIO layers on a
> filehandle.
>
> my @layers = PerlIO::get_layers($fh); # Or FH, *FH, "FH".
>
>
>> And maybe possibly manipulate (temporarily) the layer interactions.
>
>perldoc PerlIO
>[ SNIP ]
> :pop
> A pseudo layer that removes the top-most layer. Gives perl
> code a way to manipulate the layer stack.
>
>
>
>
>John
Thanks John. I went all through the PerlIO docs today and PerlIOl
yesterday. Didn't really want to but Encoding led me there. I was
somehow stuck in Encoding::PerlIO docs, had to go down more in the
left pane to find PerlIO.
Did massive tests to learn how the stack works (more like a list).
There is not much really you can do, I played with :raw, :pop, :bytes,
added multiple :encoding() layers to see how the stack works
(this is a mistake that this is actually allowed). All the time
debug printing the layer list, etc.. And :via() was interresting.
And I am not %100 sure about :encoding() layers filter accuracy.
Write a file out to UTF-16/32 (LE/BE) and its not read in the same.
On utf-32 it doesen't even write out the fffe sequence (looked at
it with a hex editor). Its probably my OS (windows) or my perl config.
I settled on this below to work rock-solid. Guess has more experience
than me on BOM (heuristics).
-sln
###################
open my $fh, $fname or die "can't open $fname...";
#binmode ($fh, ":encoding(UTF-16)");
#binmode ($fh, ":utf8");
# UTF-8/16/32 check
# ------------------
my ($UtfMsg, $Layers) = (
'UTF Check: ',
':'.join (':', PerlIO::get_layers($fh)).':'
);
if ($Layers =~ /:encoding/) {
$UtfMsg .= "Already have encoding layer";
} else {
my ($count, $sample);
my $utf8layer = $Layers =~ /:utf8/;
binmode ($fh, ":bytes");
seek ($fh, 0, 0);
if (defined($count = sysread ($fh,$sample,4,0)) && $count > 0)
{
seek ($fh, 0, 0);
use Encode::Guess;
my $decoder = guess_encoding ($sample); # ascii/utf8/BOMed UTF
if (ref($decoder)) {
my $name = $decoder->name;
$decoder = '. Do nothing';
$UtfMsg .= "guess $name";
if ($name =~ /UTF.*?(?:16|32)/i) {
# $name =~ s/(?:LE|BE)$//i;
$decoder = ". Adding $name layer";
binmode ($fh, ":encoding($name)");
}
}
$UtfMsg .= $decoder if (defined $decoder);
}
binmode ($fh, ":utf8") if ($utf8layer);
}
print STDERR "\n$UtfMsg ..\n";
#############
------------------------------
Date: Sat, 25 Jul 2009 02:04:41 -0700 (PDT)
From: xpost@mailinator.com
Subject: I've bought a passwords to porno video sites and want to present them to you absolutely for free!
Message-Id: <7a4b45d8-6da7-4459-9782-2268c71be0d8@a26g2000yqn.googlegroups.com>
I've bought a passwords to porno video sites and want to present them
to you absolutely for free!
List sites with passwords are here
http://bezsms.l4rge.com
Use them free for two days!
------------------------------
Date: Wed, 29 Jul 2009 17:37:16 -0700 (PDT)
From: bdy <bdy120602@gmail.com>
Subject: lwp::simple and rget--can I compare
Message-Id: <f09c8556-e9c5-4774-8201-ebed9406b545@i6g2000yqj.googlegroups.com>
I would like to print out the differences between the two variables
instead of just printing the varialbe again after it determines
someithing was added; I just want to print what was added. Any ideas?
#!/usr/bin/perl
use LWP::Simple;
$| = 1;
while (1) {
$firstcopy = $_;
$_ = get("http://www.google.com");
s/tagged.*\z//sm;
s/\A. *needtag. *?$//sm;
s/<[^>]+>//gm;
s/\n\n+/\n\n/gm;
if ($firstcopy ne $_) {
print ('', '', $_);
}
sleep 10;
------------------------------
Date: Wed, 29 Jul 2009 20:46:02 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: lwp::simple and rget--can I compare
Message-Id: <slrnh71ueb.ddk.tadmc@tadmc30.sbcglobal.net>
bdy <bdy120602@gmail.com> wrote:
> I would like to print out the differences between the two variables
> instead of just printing the varialbe again after it determines
> someithing was added; I just want to print what was added. Any ideas?
>
> #!/usr/bin/perl
>
>
> use LWP::Simple;
>
>
> $| = 1;
Why do you think that you need to enable auto-flushing?
> while (1) {
Where do you expect to exit this loop?
> $firstcopy = $_;
What, exactly, are you expecting the value of $firstcopy to be here?
> print ('', '', $_);
Why have you supplied those particular first two arguments to print()?
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 30 Jul 2009 05:18:04 -0700 (PDT)
From: bdy <bdy120602@gmail.com>
Subject: Re: lwp::simple and rget--can I compare
Message-Id: <eeaf48bd-452c-4da8-8bea-5dd99796d28f@o32g2000yqm.googlegroups.com>
On Jul 29, 9:46=A0pm, Tad J McClellan <ta...@seesig.invalid> wrote:
> bdy <bdy120...@gmail.com> wrote:
> > I would like to print out the differences between the two variables
> > instead of just printing the varialbe again after it determines
> > someithing was added; I just want to print what was added. Any ideas?
>
> > #!/usr/bin/perl
>
> > use LWP::Simple;
>
> > $| =3D 1;
>
> Why do you think that you need to enable auto-flushing?
>
> > while (1) {
>
> Where do you expect to exit this loop?
>
> > $firstcopy =3D $_;
>
> What, exactly, are you expecting the value of $firstcopy to be here?
>
> > print ('', '', $_);
>
> Why have you supplied those particular first two arguments to print()?
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
I didn't see this reponse; I removed my other post.
Will answers to any of your questions help you answer this question:
Can I print the difference between two variables?
In this case, the difference between $_ =3Dget("http://www.google.com")
and
$_ =3Dfirstcopy
------------------------------
Date: Thu, 30 Jul 2009 09:55:34 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: lwp::simple and rget--can I compare
Message-Id: <slrnh73cmm.68e.tadmc@tadmc30.sbcglobal.net>
bdy <bdy120602@gmail.com> wrote:
> On Jul 29, 9:46 pm, Tad J McClellan <ta...@seesig.invalid> wrote:
>> bdy <bdy120...@gmail.com> wrote:
>> > I would like to print out the differences between the two variables
>> > instead of just printing the varialbe again after it determines
>> > someithing was added; I just want to print what was added. Any ideas?
>>
>> > #!/usr/bin/perl
>>
>> > use LWP::Simple;
>>
>> > $| = 1;
>>
>> Why do you think that you need to enable auto-flushing?
>>
>> > while (1) {
>>
>> Where do you expect to exit this loop?
>>
>> > $firstcopy = $_;
>>
>> What, exactly, are you expecting the value of $firstcopy to be here?
>>
>> > print ('', '', $_);
>>
>> Why have you supplied those particular first two arguments to print()?
>>
>> --
>> Tad McClellan
>> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
It is bad manners to quote .sigs.
Have you seen the Posting Guidelines that are posted here frequently?
> Will answers to any of your questions help you answer this question:
>
> Can I print the difference between two variables?
Yes. That is why I asked them.
Your code never puts anything into $_ before it copies it to
$firstcopy, so you might as well have
$firstcopy = undef;
instead of
$firstcopy = $_;
You should always enable warnings when developing Perl code.
> In this case, the difference between $_ =get("http://www.google.com")
> and
If the get() succeeds then $_ will not contain undef, and will
probably also not contain the empty string, so
$firstcopy ne $_
will be true every single time.
The code you posted made no sense at all.
My questions were an attempt to draw some sense from it.
If you post a short and complete program *that we can run*, then
we can surely help you solve your problem. If you don't, then
we probably can't.
Have you seen the Posting Guidelines that are posted here frequently?
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
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 2530
***************************************