[18032] in Perl-Users-Digest
Perl-Users Digest, Issue: 192 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 1 14:05:52 2001
Date: Thu, 1 Feb 2001 11:05:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981054320-v10-i192@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 1 Feb 2001 Volume: 10 Number: 192
Today's topics:
(Beginner) Question about array refs <garry@heaton6.freeserve.co.uk>
Re: (Beginner) Question about array refs (Garry Williams)
Re: (Beginner) Question about array refs (Anno Siegel)
Re: (Beginner) Question about array refs <garry@heaton6.freeserve.co.uk>
Re: (Beginner) Question about array refs <garry@heaton6.freeserve.co.uk>
Re: Any good Perl books? jw_c@my-deja.com
Calling LWP from CGI - works only in offline mode ? <fulchetr@drink.bt.co.uk>
Changing alll the files in a directory (newbie) (LK)
Re: Changing alll the files in a directory (newbie) nobull@mail.com
Re: Cron task [more] jean@ematic.com
Re: Cron task [more] jean@ematic.com
Re: databases <peb@bms.umist.ac.uk>
Re: databases gnari@my-deja.com
Re: exists news reply grabber? [somewhat OT] <revjack@revjack.net>
Re: FAQ 3.0: What is perl.com? Perl Mongers? pm.org? (David H. Adler)
File is in directory and it isn't (LK)
Re: File is in directory and it isn't (Michel Dalle)
Re: File is in directory and it isn't (LK)
Re: File is in directory and it isn't (Gary E. Ansok)
Re: File is in directory and it isn't (LK)
Re: File is in directory and it isn't (Lack Mr G M)
Re: finding pop mail server given an email address (Garry Williams)
Re: finding pop mail server given an email address <bcaligari@my-deja.com>
Re: Fish v Fishing lessons - again! (was: Installing an <lmoran@wtsg.com>
Re: Fish v Fishing lessons - again! (was: Installing an <comdog@panix.com>
Re: forcing compile errors on undeclared vars? iwelch@my-deja.com
getting a match within a string? alazarev1981@my-deja.com
Re: Help Reg expr to handle variables safely? perlop co (Anno Siegel)
Re: Help with headers in IE?? <variant@shell.pacifier.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 1 Feb 2001 15:11:25 -0000
From: "Garry Heaton" <garry@heaton6.freeserve.co.uk>
Subject: (Beginner) Question about array refs
Message-Id: <95bu7t$ega$1@newsg2.svr.pol.co.uk>
Working through the Camel, I still can't work-out if:
$var = \@array ;
..... and
$var = [ @array ] ;
...... mean the same thing. Any help appreciated.
Garry Heaton
------------------------------
Date: Thu, 01 Feb 2001 15:27:12 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: (Beginner) Question about array refs
Message-Id: <kffe6.292$Sn3.11036@eagle.america.net>
On Thu, 1 Feb 2001 15:11:25 -0000, Garry Heaton
<garry@heaton6.freeserve.co.uk> wrote:
>Working through the Camel, I still can't work-out if:
>
>$var = \@array ;
>
>..... and
>
>$var = [ @array ] ;
>
>...... mean the same thing. Any help appreciated.
They're related.
The \ operator produces a reference to the thing on its right. So the
statement:
$var = \@array;
means to take a reference to the array @array and to place that in the
scalar $var.
On the other hand, the [] operator constructs an anonymous array and
returns a reference to it. The statement:
$var = [ @array ];
means that the anonymous array is constructed and the elements of
@array are *copied* into it and its reference is stored in $var.
Do you see how the two are related? The variable ends up with a
reference to an array in both cases. In the first, it's a reference
to the array @array; in the second, it's a reference to an anonymous
array that contains a copy of @array.
Does this help?
--
Garry Williams
------------------------------
Date: 1 Feb 2001 15:34:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: (Beginner) Question about array refs
Message-Id: <95bvmt$36m$1@mamenchi.zrz.TU-Berlin.DE>
Garry Heaton <garry@heaton6.freeserve.co.uk> wrote in comp.lang.perl.misc:
>Working through the Camel, I still can't work-out if:
>
>$var = \@array ;
>
>..... and
>
>$var = [ @array ] ;
>
>...... mean the same thing. Any help appreciated.
Good question. No, they don't mean the same thing though the results
behave very similar: Both make $var a reference to an array that
contains the original elements of @array.
However, "$var = \@array" makes $var a reference to the existing array
@array. This means that later changes to @array will be visible in the
reference $var as well: @$var and @array are really two different ways
of saying the same thing.
On the other hand, "$var = [ @array ]" makes an anonymous copy of @array
and assigns a reference to *that* to $var. Now, @array and @$var are
two different things (and in fact @$var is the only way to access the
latter, because the underlying array is anonymous). Changes to @array
are no longer reflected in @$var for the same reason.
It should be simple to write a little program that demonstrates these
differences. It should be instructive too.
Anno
------------------------------
Date: Thu, 1 Feb 2001 16:29:29 -0000
From: "Garry Heaton" <garry@heaton6.freeserve.co.uk>
Subject: Re: (Beginner) Question about array refs
Message-Id: <95c2qe$hf9$1@newsg2.svr.pol.co.uk>
Thanks Anno, your comparisons clarified the confusion for me.This newsgroup
is fantastic.
Garry
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:95bvmt$36m$1@mamenchi.zrz.TU-Berlin.DE...
> Garry Heaton <garry@heaton6.freeserve.co.uk> wrote in comp.lang.perl.misc:
> >Working through the Camel, I still can't work-out if:
> >
> >$var = \@array ;
> >
> >..... and
> >
> >$var = [ @array ] ;
> >
> >...... mean the same thing. Any help appreciated.
>
> Good question. No, they don't mean the same thing though the results
> behave very similar: Both make $var a reference to an array that
> contains the original elements of @array.
>
> However, "$var = \@array" makes $var a reference to the existing array
> @array. This means that later changes to @array will be visible in the
> reference $var as well: @$var and @array are really two different ways
> of saying the same thing.
>
> On the other hand, "$var = [ @array ]" makes an anonymous copy of @array
> and assigns a reference to *that* to $var. Now, @array and @$var are
> two different things (and in fact @$var is the only way to access the
> latter, because the underlying array is anonymous). Changes to @array
> are no longer reflected in @$var for the same reason.
>
> It should be simple to write a little program that demonstrates these
> differences. It should be instructive too.
>
> Anno
------------------------------
Date: Thu, 1 Feb 2001 18:33:13 -0000
From: "Garry Heaton" <garry@heaton6.freeserve.co.uk>
Subject: Re: (Beginner) Question about array refs
Message-Id: <95ca2a$cin$1@newsg3.svr.pol.co.uk>
> It should be simple to write a little program that demonstrates these
> differences. It should be instructive too.
>
> Anno
Yes, just tried this out and it works:
@array = (Garry, Michael, Mavis, Albert);
$ref = \@array;
$anon = [@array];
print "@$ref\n@$anon\n";
push @array, (Joanne);
print "@$ref\n@$anon\n";
Regards
Garry
------------------------------
Date: Thu, 01 Feb 2001 18:08:51 GMT
From: jw_c@my-deja.com
Subject: Re: Any good Perl books?
Message-Id: <95c8nb$1k6$1@nnrp1.deja.com>
In article <slrn9571ol.nmu.abigail@tsathoggua.rlyeh.net>,
abigail@foad.org wrote:
> Huh? There are more bad O'Reilly Perl books than good ones.
No argument here, but it's only fair to point out that if we abstract
this thusly:
"There are more bad $publisher $language books than good ones."
it remains true for almost all values of $publisher and $language.
My rule of thumb: if the creator of the language has written a book
about the language, get it. This usually gets you a good book.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 01 Feb 2001 18:32:16 +0000
From: tim fulcher <fulchetr@drink.bt.co.uk>
Subject: Calling LWP from CGI - works only in offline mode ?
Message-Id: <3A79ABB0.9C9D850E@drink.bt.co.uk>
Hi
I got a simple script using CGI.pm which does a fetch of some XML with
a get call using LWP::Simple.
When I run the script in the offline mode the page fetch works just
fine, but when I execute it via a browser the
get function returns undef (and yes I ran the offline test as the same
uid as the webserver). Any ideas what the problem is ?
cheers
Tim
------------------------------
Date: Thu, 01 Feb 2001 16:04:12 GMT
From: lkenny@fisheries.org (LK)
Subject: Changing alll the files in a directory (newbie)
Message-Id: <3a798601.6306873@wingate>
I am trying to change a file path in allthe files in a certain
directory. so far I am just trying to access the directory on a
windows machine. But it won't read the directory. What am I doing
wrong.
Any and all help is appreciated.
chdir("C:\WINDOWS\Desktop\My Briefcase\Perl Excercises") || die
("Cannot cd to \Perl Excercises: $!");
@files = ("C:\WINDOWS\Desktop\My Briefcase\Perl Excercises*");
print "@files\n";
LK
------------------------------
Date: 01 Feb 2001 17:58:56 +0000
From: nobull@mail.com
Subject: Re: Changing alll the files in a directory (newbie)
Message-Id: <u9vgquwahr.fsf@wcl-l.bham.ac.uk>
lkenny@fisheries.org (LK) writes:
> I am trying to change a file path in allthe files in a certain
> directory.
> chdir("C:\WINDOWS\Desktop\My Briefcase\Perl Excercises") || die
> ("Cannot cd to \Perl Excercises: $!");
You are forgetting that backslash is used in Perl (double quoted)
strings as a escape character. It you want a literal backslash then
you need two backslashes.
> But it won't read the directory. What am I doing
> wrong.
You are doing nothing to tell the computer that you want to read a directory.
> @files = ("C:\WINDOWS\Desktop\My Briefcase\Perl Excercises*");
That's a simple literal assignment statement. Nothing that attempts
any directory IO operations there.
There are two ways to read directories in Perl. One is
opendir/readdir/closedir. The other is glob(). I think you were
trying to call glob() but accidently omited the letters 'g', 'l', 'o'
and 'b'.
@files = glob("C:\\WINDOWS\\Desktop\\My Briefcase\\Perl Excercises\\*");
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 1 Feb 2001 14:03:03 -0000
From: jean@ematic.com
Subject: Re: Cron task [more]
Message-Id: <CDUIIZXY36923.6271180556@frog.nyarlatheotep.org>
On Thu, 01 Feb 2001, "TAPmaster" <thetap@home.com> wrote:
>You could call the 2nd from your first when it was done running.
heu... yes, but how to do ? Sorry, perl is a new language for me, and I am
lost in the manual :-(
Thanks..
Jean
><jean@ematic.com> wrote in message
>news:8B4XJ0LH36923.4302430556@frog.nyarlatheotep.org...
>> First, thanks to all who helped me, that's okay now.
>>
>> Something more in a cron task: I want run 2 scripts, but the second one
>> right after the first has been completed.
>> The first script never runs the same time, as it is some checks, and
>> duration is never the same.
>>
>> So how can I do to run the second JUST after the first ends ? Of course I
>> could make it to run for example 3 hours after the first, as I am sure the
>> the 1st will have been completed. But it's not a nice job :-)
>>
>> Thanks a lot,
>>
>> Jean
>>
------------------------------
Date: 1 Feb 2001 13:04:49 -0000
From: jean@ematic.com
Subject: Re: Cron task [more]
Message-Id: <HP8SUEZ336923.5866782407@frog.nyarlatheotep.org>
On Thu, 01 Feb 2001, "TAPmaster" <thetap@home.com> wrote:
>You could call the 2nd from your first when it was done running.
heu... yes, but how to do ? Sorry, perl is a new language for me, and I am
lost in the manual :-(
Thanks !
><jean@ematic.com> wrote in message
>news:8B4XJ0LH36923.4302430556@frog.nyarlatheotep.org...
>> First, thanks to all who helped me, that's okay now.
>>
>> Something more in a cron task: I want run 2 scripts, but the second one
>> right after the first has been completed.
>> The first script never runs the same time, as it is some checks, and
>> duration is never the same.
>>
>> So how can I do to run the second JUST after the first ends ? Of course I
>> could make it to run for example 3 hours after the first, as I am sure the
>> the 1st will have been completed. But it's not a nice job :-)
>>
>> Thanks a lot,
>>
>> Jean
>>
------------------------------
Date: Thu, 01 Feb 2001 16:32:32 +0000
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: databases
Message-Id: <3A798FA0.D5C78F4E@bms.umist.ac.uk>
> here all the program hello.pl as it is in the book of O'Reilly "programing
> in perl"(the lama book!).
> To run this program I run the shell command in Windows 98:
> (start/run: command)
> And Ichange the path like this :
> PATH=c:\perl\bin;c:\perl\eg
>
> And I call the program like this :
> perl c:\perl\eg\hello.pl
> I've try perl hello.pl but it doesn't work
> maybe the problem is in this path because I've the same problem for Java
> with the path.
> maybe the program autoexec.bat should be modify.Any idea!!
so, what errors are reported?
it looks like the script should be run from the same directory as your
'database' file.
Is this what's going wrong?
Paul
------------------------------
Date: Thu, 01 Feb 2001 16:44:06 GMT
From: gnari@my-deja.com
Subject: Re: databases
Message-Id: <95c3oj$slj$1@nnrp1.deja.com>
In article <95c01c$89k$1@wanadoo.fr>,
"mellouet ronan" <mellouet.ronan@wanadoo.fr> wrote:
> Ok,
>
> And I call the program like this :
> perl c:\perl\eg\hello.pl
> I've try perl hello.pl but it doesn't work
this suggests that that you are confusing path and current directory
path thells the operating system where to find executables
so when you do
perl hello.pl
the os looks for a executable in the dirs listed in the PATH, and
your command is transformed to
c:\perl\bin\perl hello.pl
the hello.pl is just an argument to perl, and has no meaning to the os,
and in particular is not assumed to be a filename, so any path
application is not relevant
now when you start the program with
perl c:\perl\eg\hello.pl
the current directory is still whatever it was before the command, so
> open (WORDSLIST, "wordslist")||die "can't open wordslist:$!";
this tries to open the file there. for this to work, you must do
cd c:\perl\eg
before starting your program (assuming the file is in that same dir)
>
> begin 666 wordlist.dat
> M9G)E9 T*8V%M96P-"F)A<FYE>0T*;&QA;6$-"F)E='1Y#0IA;'!A8V$-"G=I
> -;&UA#0IA;'!A8V$-"@``
> `
> end
what is this?
is your datafile called wordlist.dat or wordslist ?
hope this helps you
gnari
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 1 Feb 2001 15:35:56 GMT
From: revjack <revjack@revjack.net>
Subject: Re: exists news reply grabber? [somewhat OT]
Message-Id: <95bvos$in6$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Chris Stith <mischief@velma.motion.net> wrote:
: Abigail <abigail@foad.org> wrote:
:> J?rg Ziefle (gt4556a@acmey.gatech.edu) wrote on MMDCCX September MCMXCIII
:> in <URL:news:slrn97ghiu.ri7.gt4556a@acmey.gatech.edu>:
:> }} On 31 Jan 2001 08:58:54 GMT, Abigail <abigail@foad.org> wrote:
:> }}
:> }} >I guess you could ask Kibo....
:> }}
:> }} Ok, if now somebody could tell me what or who kibo is or where to find it/him,
:> }} then this would all make more sense to me :)
:> }}
:> }} You're not talking about www.kibo.com, aren't you?
:> That's his web site.
:> HappyNet rulez.
: Doesn't alt.religion.kibology still exist? ;)
Sometimes we even manage to get away from our computers:
http://www.revjack.net/usenet/ark/zoo/
But not for long.
--
___________________
revjack@revjack.net
------------------------------
Date: 1 Feb 2001 18:06:15 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: FAQ 3.0: What is perl.com? Perl Mongers? pm.org? perl.org?
Message-Id: <slrn97j9cn.d5s.dha@panix2.panix.com>
On Thu, 01 Feb 2001 02:57:34 -0500, brian d foy <comdog@panix.com> wrote:
>In article <N38e6.1528$B9.195708416@news.frii.net>, PerlFAQ Server
><faq@denver.pm.org> wrote:
>
>> Perl Mongers is an advocacy organization for the Perl language. For
>> details, see the Perl Mongers web site at http://www.perlmongers.org/.
>
>that should be www.perl.org.
>
>[dha - what's up with that ;) ]
I forget when this was last patched. Also, there has been some
indication lately that the FAQ autoposter may not be posting the most
up to date entries... I'll have to take a look.
>> AUTHOR AND COPYRIGHT
>>
>> Copyright (c) 1997-1999 Tom Christiansen and Nathan
>> Torkington. All rights reserved.
>
>there's a problem here. i think dha wrote the most (if not all)
>of the content of that answer.
Interesting point. :-) Actually, I'll have to check this as
well... (I think I may have just patched some existing stuff - but
maybe I'm just being modest again... :-).
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"It must be difficult being such a visionary."
"Not really. You just have to drink a whole lot."
- http://www.goats.com/archive/index.html?990420
------------------------------
Date: Thu, 01 Feb 2001 17:16:34 GMT
From: lkenny@fisheries.org (LK)
Subject: File is in directory and it isn't
Message-Id: <3a7998e4.11141863@wingate>
The following code produces results of the followin.
It prints the file, so it recognizes it as being in the directory, but
then puts up an error message saying it can't open the file because
there is no such file or directory.
I can't figure out what is going on. It recognizes the html file as
being there, but then says it doesn't exist
Any ideas?
#!/usr/local/bin/perl
opendir(DIR, "X:\\newtest") || die ("Cannot cd to \\newtest: $!");
@files=readdir(DIR);
foreach $file(@files){
if ($file =~ /\.htm/){
print "$file\n";
if (-r $file && -w $file){
open(FILE, "<<$file") || die ("Cannot open
$file: $!");
while (<FILE>){
$_ =~ s/ARACHNOPHILIA//ieg;
}
}else{
print "$file is not readable: $!\n";
}
close(FILE);
}
}
closedir(DIR);
I aprreciate anyone who can shed some light on this for me.
LK
------------------------------
Date: Thu, 01 Feb 2001 17:32:37 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: File is in directory and it isn't
Message-Id: <95c6lu$kh3$1@news.mch.sbs.de>
In article <3a7998e4.11141863@wingate>, lkenny@fisheries.org (LK) wrote:
>The following code produces results of the followin.
>It prints the file, so it recognizes it as being in the directory, but
>then puts up an error message saying it can't open the file because
>there is no such file or directory.
>I can't figure out what is going on. It recognizes the html file as
>being there, but then says it doesn't exist
>Any ideas?
>
>#!/usr/local/bin/perl
>
>opendir(DIR, "X:\\newtest") || die ("Cannot cd to \\newtest: $!");
>
The problem is right here - opendir() does not CHANGE the
current directory to X:\newtest. It simply opens that directory
from wherever you are at the time - maybe in Y:\oldtest :)
So if you want to open the $file, you have to add X:\\newtest\\
(or X:/newtest/) in front of it in the open()...
HTH,
Michel.
------------------------------
Date: Thu, 01 Feb 2001 17:43:05 GMT
From: lkenny@fisheries.org (LK)
Subject: Re: File is in directory and it isn't
Message-Id: <3a799fe7.12937857@wingate>
On Thu, 01 Feb 2001 17:32:37 GMT, michel.dalle@usa.net (Michel Dalle)
wrote:
>In article <3a7998e4.11141863@wingate>, lkenny@fisheries.org (LK) wrote:
>>The following code produces results of the followin.
>>It prints the file, so it recognizes it as being in the directory, but
>>then puts up an error message saying it can't open the file because
>>there is no such file or directory.
>>I can't figure out what is going on. It recognizes the html file as
>>being there, but then says it doesn't exist
>>Any ideas?
>>
>>#!/usr/local/bin/perl
>>
>>opendir(DIR, "X:\\newtest") || die ("Cannot cd to \\newtest: $!");
>>
>
>The problem is right here - opendir() does not CHANGE the
>current directory to X:\newtest. It simply opens that directory
>from wherever you are at the time - maybe in Y:\oldtest :)
>
>So if you want to open the $file, you have to add X:\\newtest\\
>(or X:/newtest/) in front of it in the open()...
>
>HTH,
>
>Michel.
I appreciate your help. I am still getting the following error
message:
Cannot open X:\newtest\untitled1.html: No such file or directory at
c:\windows\TEMP\DzTemp.pl line 13.
The code now looks like this:
#!/usr/local/bin/perl
opendir(DIR, "X:\\newtest\\") || die ("Cannot cd to \\newtest: $!");
@files=readdir(DIR);
foreach $file(@files){
if ($file =~ /\.htm/){
print "$file\n";
$nf = "X:\\newtest\\".$file;
if (-r $nf && -w $nf){
open(FILE, "<<$nf") || die ("Cannot open $nf:
$!");
while (<FILE>){
$_ =~ s/ARACHNOPHILIA//ieg;
}
}else{
print "$nf is not readable: $!\n";
}
close(FILE);
}
}
closedir(DIR);
Can you see anything? I know the directory and the files exist.
LK
------------------------------
Date: 1 Feb 2001 18:04:44 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: File is in directory and it isn't
Message-Id: <95c8fs$3lp@gap.cco.caltech.edu>
In article <3a799fe7.12937857@wingate>, LK <lkenny@fisheries.org> wrote:
>Cannot open X:\newtest\untitled1.html: No such file or directory at
>c:\windows\TEMP\DzTemp.pl line 13.
>
>The code now looks like this:
>
> open(FILE, "<<$nf") || die ("Cannot open $nf: $!");
Try using just one (or zero) left angle bracket symbol instead of two.
-- Gary
------------------------------
Date: Thu, 01 Feb 2001 18:24:45 GMT
From: lkenny@fisheries.org (LK)
Subject: Re: File is in directory and it isn't
Message-Id: <3a79a9d3.15477476@wingate>
On Thu, 01 Feb 2001 17:16:34 GMT, lkenny@fisheries.org (LK) wrote:
>The following code produces results of the followin.
>It prints the file, so it recognizes it as being in the directory, but
>then puts up an error message saying it can't open the file because
>there is no such file or directory.
>I can't figure out what is going on. It recognizes the html file as
>being there, but then says it doesn't exist
>Any ideas?
>
>#!/usr/local/bin/perl
>
>opendir(DIR, "X:\\newtest") || die ("Cannot cd to \\newtest: $!");
>
>@files=readdir(DIR);
>
>foreach $file(@files){
> if ($file =~ /\.htm/){
> print "$file\n";
> if (-r $file && -w $file){
> open(FILE, "<<$file") || die ("Cannot open
>$file: $!");
> while (<FILE>){
> $_ =~ s/ARACHNOPHILIA//ieg;
> }
> }else{
> print "$file is not readable: $!\n";
> }
> close(FILE);
> }
>}
>
>closedir(DIR);
>
>
>
>I aprreciate anyone who can shed some light on this for me.
>LK
Thanks to both of you. You guys put me onthe right track and I
figured out how to accomplish my goal.
Cheers,
LK
------------------------------
Date: Thu, 01 Feb 2001 18:17:41 GMT
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: File is in directory and it isn't
Message-Id: <2001Feb1.181741@ukwit01>
In article <3a7998e4.11141863@wingate>, lkenny@fisheries.org (LK) writes:
|>
|> The following code produces results of the followin.
|> It prints the file
I'll presume you mean that it prints the name of the file...
|> so it recognizes it as being in the directory, but
|> then puts up an error message saying it can't open the file because
|> there is no such file or directory.
This is true...as RTFM would show you.
|> open(FILE, "<<$file") || die ("Cannot open $file: $!");
If you wish to open it for reading use "$file" (or "<$file").
However, having 2 '<'s at the start means that the first is taken to
mean "open for reading" while the second is taken as part of the
filename. So the code tries to open a file called "$file" with a
prepended '<'. Not surprisingly, this is not there.
--
--------- Gordon Lack --------------- gml4410@ggr.co.uk ------------
This message *may* reflect my personal opinion. It is *not* intended
to reflect those of my employer, or anyone else.
------------------------------
Date: Thu, 01 Feb 2001 15:05:01 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: finding pop mail server given an email address
Message-Id: <xWee6.288$Sn3.11036@eagle.america.net>
On Thu, 01 Feb 2001 13:53:44 GMT, soumitra <soumitra123@my-deja.com> wrote:
>given an email address how do I find
>out if that address allows pop mail access
>and what is the pop mail server name for that address.
That's not possible.
You can find out what the MX hosts are, but not which one actually
received any particular message. Moreover, the mail exchanger(s)
published in the DNS don't have to be the server that recipients use
to retrieve their mail. The mail delivery agent can be virtually
anything. (A common example is uucp-delivered mail. Another common
example is forwarding done on the MX host.) The MDA is *not*
published in any way. Even if you could determine the MDA and the
final disposition of mail on some host and even if that host were
accessible from your host, you still couldn't tell whether any
particular mail box was accessed with the POP protocol.
--
Garry Williams
------------------------------
Date: Thu, 01 Feb 2001 16:10:10 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: finding pop mail server given an email address
Message-Id: <95c1oq$qfn$1@nnrp1.deja.com>
In article <95bpp4$iqe$1@nnrp1.deja.com>,
soumitra <soumitra123@my-deja.com> wrote:
> Hi!
> given an email address how do I find
> out if that address allows pop mail access
> and what is the pop mail server name for that address.
it is impossible to tell. A domain may have many
pop servers for it's email, and it might be
information not listed in dns
B
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 01 Feb 2001 09:41:12 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Fish v Fishing lessons - again! (was: Installing and using modules when you're not root?)
Message-Id: <4bti7t85p8m8vo4n6b0l4fnql7deshfm42@4ax.com>
On Thu, 01 Feb 2001 02:53:41 -0500, brian d foy <comdog@panix.com>
wrote wonderful things about sparkplugs:
>In article <95ar5d$r19$1@nnrp1.deja.com>, dtbaker_dejanews@my-deja.com
>wrote:
>
>> I know that many times I cant find things in the perldocs even after a
>> good half hour of looking unless someone helps with what area to look
>> in.
>
>sounds like you need
>
>
http://www.perldoc.com --Now with 50% RTFM!
"> thanks in advance !!!
If you are going to do anything "in advance" it should be RTFM."
--swiped from a nobull clp.misc post
lmoranATwtsg.com
------------------------------
Date: Thu, 01 Feb 2001 10:45:35 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Fish v Fishing lessons - again! (was: Installing and using modules when you're not root?)
Message-Id: <comdog-FB9F42.10453501022001@news.panix.com>
In article <4bti7t85p8m8vo4n6b0l4fnql7deshfm42@4ax.com>, Lou Moran
<lmoran@wtsg.com> wrote:
> http://www.perldoc.com --Now with 50% RTFM!
that should be STFM (search the fine manual). ;)
--
brian d foy <comdog@panix.com>
------------------------------
Date: Thu, 01 Feb 2001 15:17:22 GMT
From: iwelch@my-deja.com
Subject: Re: forcing compile errors on undeclared vars?
Message-Id: <95buln$neh$1@nnrp1.deja.com>
In article <G_%d6.165942$P82.19896267@news1.rdc1.ct.home.com>,
Dan Sugalski <dan@tuatha.sidhe.org> wrote:
> iwelch@my-deja.com wrote:
>
> > I presume the silence means that the answer here is "no". It is
> > impossible to require definition at compilation time when a variable
> > name contains a module identifier...
>
> The answer is, in fact, no. Fully qualifying a variable name is enough
> to make strict happy.
>
Looks like we need a
use superstrict;
pragma. Is there a way to formally suggest this, or has this already
been suggested to the Perl community?
/iaw
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 01 Feb 2001 17:16:47 GMT
From: alazarev1981@my-deja.com
Subject: getting a match within a string?
Message-Id: <95c5ll$uji$1@nnrp1.deja.com>
Hi,
I need to create a new file, the name of which is a pattern found in a
line from another file that already exists.
Here's my code (doesn't work):
#!/usr/local/bin/perl -w
my(@xmlFileArray);
open(XMLFILE, "<blah.xml");
$i=0;
while(<XMLFILE>) {
$xmlFileArray[$i] = $_;
$i++;
}
close(XMLFILE);
open(XMLFILE, "<blah.xml");
foreach(@xmlFileArray) {
if($_ =~ / <Member number="\d{4}-\d{3}" status="\w+">$/) {
############
# i need to make a new file with a name that matches
# the \d{4}-\d{3} pattern in the if condition above
############
$newXMLFileName = m/\d{4}-\d{3}/;
print "$newXMLFileName\n"; # prints the number 1???!!!
}
}
close(XMLFILE);
I've read my perl books and looked at perldoc and perl.com and I can't
find the answer?! Any help is appreciated.
Thanks in advance,
Alex Lazarevich
alazarev@itg.uiuc.edu
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 1 Feb 2001 14:12:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help Reg expr to handle variables safely? perlop confusing.
Message-Id: <95bqst$lmd$1@mamenchi.zrz.TU-Berlin.DE>
<nobull@mail.com> wrote in comp.lang.perl.misc:
>chuckk@monmouth.com writes:
>
>> I've just read the perlop section of the faq on quoting.
>> But I'm still confused about special charaters in the string like
>
>
>> Say I have a variable that contains the following:
>> $a='mydir/myfile$_&?.txt';
>> $b='$_&?';
>> $c='^&*"';
>>
>> $d= $a;
>> $d =~ s,\Q$b\E,\Q$c\E,g;
>>
>> IS THIS THE SAFEST SIMPLEST WAY - OR WHAT OTHER WAYS COULD I DO THIS?
>
>Yes, but IHMO it looks untidy.
>
>Well IMHO comma is a poor choice of delimiter for s///g - especially
>if there's no reason not to use the forward slash. Oh, and the \E are
>redundant.
>
> $d =~ s/\Q$b/\Q$c/g;
>
>This is semantically exaclty the same as your solution.
I'd question the use of \Q on the replacement side. There is normally
no need to do that, and the effect is to insert not the literal con-
tents of $c but its quotemeta()d equivalent.
Anno
------------------------------
Date: 1 Feb 2001 08:45:23 PDT
From: Jason Hurst <variant@shell.pacifier.com>
Subject: Re: Help with headers in IE??
Message-Id: <3a7992a3_1@news.pacifier.com>
> IE doesn't have a clue what Mime headers are. You have to
> learn to trick it with /path info.
whats the '/path' info, i'm not sure i understand... I should point out
that i works fine in IE4.0, but not in ie5.5, is this a recent problem
with ie?
Maggert <perl@imchat.com> wrote:
> On Thu, 01 Feb 2001 01:01:04 GMT, Jason Hurst <gorgano@altavista.com>
> wrote:
>>ok, here is a fun one. I've got these binary files i want to send to
>>the browser. Now because of sercurity stuff i'm using a perl script to
>>read in the file and then send it on it's way. Pretty basic, open the
>>file, bindmod it and stdout, then do a read() and simply print out the
>>data a little bit at a time. Works fine in netscape, but for some
>>reason when i'm using IE, it First prompts if i want to save or open
>>the script file, if you hit open, it then asks if you want to save or
>>open the script file AGAIN, hit open, and THEN it asks if you want to
>>save the file. Anyone seen anything like this? the headers i'm using
>>are like this:
>>
>>Content-Disposition: attachment; filename="addbook-1.0.tar.gz"
>>Content-Type: application/octet-stream
>>
>>NOte this also happens on text/plain, but not with text/html..
>>
>>any guesses? Thanks for your help!
>>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 192
**************************************