[12315] in Perl-Users-Digest
Perl-Users Digest, Issue: 5915 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 7 20:07:27 1999
Date: Mon, 7 Jun 99 17:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 7 Jun 1999 Volume: 8 Number: 5915
Today's topics:
Re: a problem with open( ,system()) <rootbeer@redcat.com>
Re: FAQ 5.31: Why can't I use "C:\temp\foo" in DOS path (Kevin Reid)
Re: File uploading question <rootbeer@redcat.com>
Re: File uploading question <dtbaker@bus-prod.com>
Re: Getting old values <rootbeer@redcat.com>
Re: HELP: Permission Denied retrieving remote URL <rootbeer@redcat.com>
Re: How to start a script and give it some variables ? <rootbeer@redcat.com>
Re: Input from a pop-up html form <rootbeer@redcat.com>
Re: Input from a pop-up html form <dtbaker@bus-prod.com>
Re: more... <rootbeer@redcat.com>
Need a banner script <cypress@interpath.com>
Re: nested interpolation <rootbeer@redcat.com>
perl > NTMail <rob@rtanet.com>
Re: Perl/RE savvy??? <*@qz.to>
Re: Permissions problem? <rootbeer@redcat.com>
Re: read-accessing hash element implicitely defines has (Larry Rosler)
Re: read-accessing hash element implicitely defines has <uri@sysarch.com>
reclaim memory? bing-du@tamu.edu
REDIRECT in the BODY of a HTML page... <pruefer@idnet.de>
Re: Split <jeromeo@atrieva.com>
Re: Split (Larry Rosler)
Re: Split RABM@prodigy.net
Re: Strip "http" from URL's <grayku@my-deja.com>
Re: The artistic license and perl: <rra@stanford.edu>
Re: Using string variable as name of subroutine to call (Tad McClellan)
Why doesn't this work: open(STDOUT, "| tee >>$file") <inca@incaic.engr.sgi.com>
Win32::NetResource::AddConnection() (Brandon Metcalf)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 7 Jun 1999 16:52:30 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: a problem with open( ,system())
Message-Id: <Pine.GSO.4.02A.9906071650580.17029-100000@user2.teleport.com>
On Mon, 7 Jun 1999, ZENG wrote:
> open (PROG, "system(who) |"); #don't work. don't know why
Checking the return value may be informative. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 7 Jun 1999 18:01:13 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: FAQ 5.31: Why can't I use "C:\temp\foo" in DOS paths? What doesn't `C:\temp\foo.exe` work?
Message-Id: <1dsyawo.1u2iue61jbasmwN@[192.168.0.1]>
Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
> Why can't I use "C:\temp\foo" in DOS paths? What doesn't
> `C:\temp\foo.exe` work?
^^^^^^^^^^^^
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Mon, 7 Jun 1999 15:33:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: File uploading question
Message-Id: <Pine.GSO.4.02A.9906071530190.17029-100000@user2.teleport.com>
On Mon, 7 Jun 1999, Alex wrote:
> Newsgroups: comp.lang.perl, comp.lang.perl.misc
If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.
> I intend to use the file-uploading script from Jeff Carnahan.This is a
> very good script, indeed.
I'll take your word for that. :-)
> If I only allow people to upload the specified filenames, e.g.
> upload1.html, upload2.html and upload3.html. Filenames other than
> these are not allow to upload. How can I do that ?
Probably you'll want a pattern match. See the perlre manpage.
But if you're not sure what to do so that a browser will report that the
upload is disallowed, check with the docs, FAQs, and newsgroups about
browsers, servers, CGI programming, and the protocols you're using.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 07 Jun 1999 17:54:55 -0500
From: Dan Baker <dtbaker@bus-prod.com>
Subject: Re: File uploading question
Message-Id: <375C4DBF.7942403E@bus-prod.com>
> > If I only allow people to upload the specified filenames, e.g.
> > upload1.html, upload2.html and upload3.html. Filenames other than
> > these are not allow to upload. How can I do that ?
------------
I recently found some pretty good examples at http://www.idocs.com and
the full doc for CGI.pm at
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
The key thing that eluded me for a couple days of hair pulling is that
the CGI.pm automatically creates an OPEN filehandle by the same name as
the cgi var holding the filename! It can get a little weird to keep
track of.
I suppose that for only allowing .htm or .html uploads you could use
javascript on the front side, or read the first few lines on the server
side to be sure. One thing you probably want to do for SURE is limit the
size of the upload file!
the HTML snippet:
<br>
<form ENCTYPE="multipart/form-data" METHOD="POST"
ACTION="cgi-bin/convert_ldif2html.pl">Or,
enter file path:<input NAME="UploadFilepath" TYPE="file" VALUE="*"
SIZE=60 ><input type=submit value="Run">
<br>you need to use the full pathname like:
C:\Xitami\webpages\utilities\data\addressbook.ldif</form>
perl snippets:
# external subs
use CGI qw( param tmpFileName );
use CGI::Carp 'fatalsToBrowser';
$CGI::POST_MAX = 102400; # set maximum size of post to 100k
my $UploadFilepath = param( 'UploadFilepath' ); # may be sent from form
# if it exists it can be used as BOTH a scalar and a filehandle!!!
if ( $UploadFilepath ) { # load from file passed in
print OUTPUTFILE "...We got passed a file<br>\n";
# see what the tmpFileName actually is just for fun
$temp = tmpFileName ( $UploadFilepath );
print OUTPUTFILE "...just FYI, tmpFileName() says the file is stored in
$temp <br>\n";
print OUTPUTFILE "...loading the data passed in file $UploadFilepath
and closing the open FH <br>\n" ;
@RawList = <$UploadFilepath>;
close $UploadFilepath;
... process @RawList
------------------------------
Date: Mon, 7 Jun 1999 15:23:34 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Getting old values
Message-Id: <Pine.GSO.4.02A.9906071522590.17029-100000@user2.teleport.com>
On 7 Jun 1999, SiFo wrote:
> I=B4ve got a form that I stores the data from in a plain text file. To
> access this form I use a simple login script that prompts for username
> and password. I do want useres to be able to see their old responses
> before submitting the data...is this hard to do?
Not especially. You probably want to use the CGI module or a similar one.
Cheers!
--=20
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 7 Jun 1999 15:44:46 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HELP: Permission Denied retrieving remote URL
Message-Id: <Pine.GSO.4.02A.9906071538060.17029-100000@user2.teleport.com>
On Mon, 7 Jun 1999, Greg wrote:
> I am having problems retrieving a remote URL. I wrote a script using
> LWP::Simple with the LWP and supporting modules copied into a library
> directory.
> use lib ('/home/username/public_html/cgi-bin/lib');
> use LWP::Simple;
> $content = get($url);
>
> I successfully ran the script without errors on my home webpage, but
> it returns a 500 Internal Server error on my free web host on
> virtualave.net with the same module files copied into a library
> directory. Virtualave.net does not allow telnet access, so I can't run
> the script from the command line. I found a newsgroup article which
> mentioned how to catch the error and wrote the folllowing script.
[ Somewhat long, yet informative, script snipped. ]
> When this script is run from the browser, I get the displayresults
> subroutine to display the error: IO::Socket::INET Permission Denied
>
> Any ideas of what my problem(s) is?
It's tough to say, but it looks as if you're getting Permission Denied
from the remote machine. How can that be? The remote machine may be a
proxy server refusing to let requests go out. You may be able to get
help on this from a system administrator at the site. In any case, you
seem to have gotten beyond the scope of Perl.
By the way, yours was one of the best-written descriptions of a complex
problem I've seen in some time. Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 7 Jun 1999 15:25:31 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to start a script and give it some variables ?
Message-Id: <Pine.GSO.4.02A.9906071524180.17029-100000@user2.teleport.com>
On Mon, 7 Jun 1999, Mag wrote:
> How do I get my first script to start the others and give
> them this information?
See whether the perlipc manpage, and the entry for system() in the
perlfunc manpage, don't lead you to the answer. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 7 Jun 1999 15:52:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Input from a pop-up html form
Message-Id: <Pine.GSO.4.02A.9906071547410.17029-100000@user2.teleport.com>
On Mon, 7 Jun 1999, Barth, Brian (EXCHANGE:BNRTP:0S31) wrote:
> I have a multiple selection pop-up html form in a perl script and i need
> to send all the selected options to another script.
> the form is method=get
> how do read in all the selected options into an array in the called
> script?
This is unclear to me. Here are two possible meanings and answers:
1. You have two programs, and one needs to communicate directly with the
other. See the perlipc manpage.
2. You have one program which generates a web page containing a form, and
a second one which processes the submitted data from the form. Have the
form incorporate information in (possibly hidden) fields. See the CGI
module's docs.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 07 Jun 1999 18:25:38 -0500
From: Dan Baker <dtbaker@bus-prod.com>
Subject: Re: Input from a pop-up html form
Message-Id: <375C54F2.BAD5DDFC@bus-prod.com>
Tom Phoenix wrote:
>
> On Mon, 7 Jun 1999, Barth, Brian (EXCHANGE:BNRTP:0S31) wrote:
>
> > I have a multiple selection pop-up html form in a perl script and i need
> > to send all the selected options to another script.
> > the form is method=get
> > how do read in all the selected options into an array in the called
> > script?
----------------------
you can read your locally installed perl docs, or check out
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
Dan
------------------------------
Date: Mon, 7 Jun 1999 16:42:10 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: more...
Message-Id: <Pine.GSO.4.02A.9906071639590.17029-100000@user2.teleport.com>
On Mon, 7 Jun 1999 jknoll@my-deja.com wrote:
> The network security system we have is supposed to catch this. (having
> a directory the same name as a function) But this subdirectory PIPE is
> so deep (like 6 directories) that our Novell system did not catch it.
So, you're saying that installing a directory named PIPE is (or should be)
disallowed on a Novell system? Have you filed a bug report with Novell
about this?
I'm not 100% certain that this is really Perl's fault, although if there
is a list of such reserved directory names, perhaps we could come up with
some way of avoiding them. If there is such a list, please use the perlbug
command to report this problem. Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 07 Jun 1999 07:12:03 -0500
From: dave silva <cypress@interpath.com>
Subject: Need a banner script
Message-Id: <375C5278.4648@interpath.com>
Greetings,
Forgive me if this is not appropriate use of this news group and point
me in the right direction and i'll go away.
But, we need a banner rotation script that is fairly simple and can
handle lots of traffic. We have a sight that gets 40,000 hit a day but
for the time being isn't making any money (otherwaise i'd be looking to
hire one of you).
Several banner scripts that we've tried seem to crack under the load.
We'd be grateful for some suggestions
Thanx
Dave Silva
cypress@netmar.com
------------------------------
Date: Mon, 7 Jun 1999 16:49:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: nested interpolation
Message-Id: <Pine.GSO.4.02A.9906071645450.17029-100000@user2.teleport.com>
On Mon, 7 Jun 1999 kgentes@gentek.net wrote:
> I tried the following, but it did not work:
>
> $prvRec{$HEADERDEF[$col_num++]} = stripblanks($columndata);
>
> By replacing it with a decomposed set of statements
> and using temporary variables, it works like this
If you can make a small stand-alone example which shows what's going on,
I'm sure someone here will be able to help you find the trouble. Try to
keep it down to under ten lines or so. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 7 Jun 1999 23:56:53 +0100
From: "Rob Taylerson" <rob@rtanet.com>
Subject: perl > NTMail
Message-Id: <928796355.11727.0.nnrp-06.c29f6803@news.demon.co.uk>
can anyone recommend a perl script that reliably handles the conversation
from a webserver to an NT based mailserver (NT Mail ver 4).
Its just the HELO... RCPT TO etc etc bit that we can't make work.
many thanks
rob taylerson
------------------------------
Date: 7 Jun 1999 22:31:05 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Perl/RE savvy???
Message-Id: <eli$9906071816@qz.little-neck.ny.us>
In comp.lang.perl.misc, Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> Larry Rosler wrote in article <MPG.11c582307bb0900e989b7d@nntp.hpl.hp.com>:
> > > Obviously, I could write '/^(des|desc|descr|descri|describ|describe)$/'
> > > (which I guess is really the most efficient...) but shouldn't it be
> > > possible to write it in a more compact way?
> > The best I can do is factor it from the left. The '(?:' parentheses
> > stop the regex engine from doing unnecessary storing of the intermediate
> > matches.
> > /^des(?:c(?:r(?:i(?:be?)?)?)?)?$/i
> I do not know which is more readable, but one can achieve the same by
> /^des(c|$)(r|$)(i|$)(be?|$)$/
> (though it may be less effecient). Of course, the proper solution is
> to use substr:
> length($input) >= 3 and (substr $pattern, length($input)) eq lc $input
Sure, let's try them. You mean substr($pattern, 0, length($input),
of course. The use of (c|$) vs. (?:c|$) can be a big hit if $1, etc
are used. I don't know how well optimized this is, but newer perls
probably do a better.
Benchmark: timing 50000 iterations of catenated, nested, reiteration, substr().
catenated: 66 wallclock secs (24.04 usr + 2.01 sys = 26.05 CPU)
nested: 33 wallclock secs (21.01 usr + 1.99 sys = 23.00 CPU)
reiteration: 40 wallclock secs (21.04 usr + 1.86 sys = 22.90 CPU)
substr(): 29 wallclock secs (15.40 usr + 1.50 sys = 16.90 CPU)
Elijah
------
#!/usr/bin/perl -w
use Benchmark;
my @what = qw(des desc descr descri describ describe described);
my $rc;
timethese(50000, {
'reiteration' => sub {
foreach (@what) {
$rc = /^(des|desc|descr|descri|describ|describe)$/i;
}
},
'nested' => sub {
foreach (@what) {
$rc = /^des(?:c(?:r(?:i(?:be?)?)?)?)?$/i;
}
},
'catenated' => sub {
foreach (@what) {
$rc = /^des(c|$)(r|$)(i|$)(be?|$)$/i;
}
},
'substr()' => sub {
foreach (@what) {
$rc = ((length($_) >= 3) and
(substr('describe', 0, length($_)) eq lc $_));
}
}
});
__END__
------------------------------
Date: Mon, 7 Jun 1999 16:38:54 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Permissions problem?
Message-Id: <Pine.GSO.4.02A.9906071635050.17029-100000@user2.teleport.com>
On Mon, 7 Jun 1999, Jared Hecker wrote:
> If I can stat $_ directory a with the expected result, but a stat $_
> against directory b produces only a list of the file names (i.e., the
> associated array is null), is this some sort of permissions problem?
stat() should never return a list of file names (unless you have files
with interesting names, I suppose... :-) But if stat returns an empty
list, $! should be set to a useful and informative error message. Good
luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 7 Jun 1999 15:09:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: read-accessing hash element implicitely defines hash, or I found a bug?
Message-Id: <MPG.11c5e2f531b8b65c989b87@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <x3yr9nn3f8z.fsf@tigre.matrox.com> on Mon, 7 Jun 1999
16:52:29 -0400 , Ala Qumsieh <aqumsieh@matrox.com> says...
...
> Yes and yes. You are experiencing what is known as
> "autovivification". When you try to access a non-existing element of a
> hash, Perl will automatically create one for you. This is probably a
> misfeature (not a bug, since it is well-known and documented), which
> can not be "fixed" since many programs already depend on it. You can
> overcome it by testing with exists() before trying to access the
> element.
You have that somewhat wrong. Autovivification will create any
intermediate levels of aggregates needed. It will not create the actual
element if it doesn't exit -- it will return 'undef'. It is not
necessary to use 'exists' before trying to access the element.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 07 Jun 1999 18:53:04 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: read-accessing hash element implicitely defines hash, or I found a bug?
Message-Id: <x7u2sj7hdb.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> [Posted and a courtesy copy mailed.]
LR> In article <x3yr9nn3f8z.fsf@tigre.matrox.com> on Mon, 7 Jun 1999
LR> 16:52:29 -0400 , Ala Qumsieh <aqumsieh@matrox.com> says...
LR> ...
>> Yes and yes. You are experiencing what is known as
>> "autovivification". When you try to access a non-existing element of a
>> hash, Perl will automatically create one for you. This is probably a
>> misfeature (not a bug, since it is well-known and documented), which
>> can not be "fixed" since many programs already depend on it. You can
>> overcome it by testing with exists() before trying to access the
>> element.
LR> You have that somewhat wrong. Autovivification will create any
LR> intermediate levels of aggregates needed. It will not create the actual
LR> element if it doesn't exit -- it will return 'undef'. It is not
LR> necessary to use 'exists' before trying to access the element.
but even using exists will autovivify any intermediate levels of
aggregates. i feel that is a design flaw as exists should fail if any
intermediate level fails to exist. but that is what we have and we have
to live with it. the behavior of Autovivification is not going to
change.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Mon, 07 Jun 1999 20:55:27 GMT
From: bing-du@tamu.edu
Subject: reclaim memory?
Message-Id: <7jhbjq$1lu$1@nnrp1.deja.com>
Greetings all...
open IN, "<$file" or die "Can't open $file: $!\n";
while(<IN>) {
push @lines, $_;
if($. % 1000) {
&_do_stuff(\@lines);
@lines = ();
}
}
&_do_stuff(\@lines) if @lines;
@lines = ();
close IN;
}
Even though I set @lines = () after processing @lines, the memory still
kept growing till "out of memory". The total entries in file <IN> is
25,000.
How to prevent memory leaking? I need your help with this badly.
Thanks in advance for any suggestions.
Bing
sub _do_stuff {
my(@array) = @ { shift };
.
.
.
}
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 8 Jun 1999 00:41:52 +0100
From: "Claus Pruefer" <pruefer@idnet.de>
Subject: REDIRECT in the BODY of a HTML page...
Message-Id: <7jhhu8$o2a$1@newsreader.ipf.de>
hi there!
i want do do a simple REDIRECT. the fact is: i dont want do do it in the
HEADER of an html-page. is this possible?
the problem is:
HTML-Page creates INPUT-fields, if you hit the TRANSMIT button, the data is
given to a CGI-Script, which creates a HTML-page (HEADER & BODY), now in the
BODY i create RADIO-BUTTONS with a NEW TRANSMIT button...
if you hit the TRANSMIT button there should be 2 different possibilities:
if the user selected "yes" from the radio button the cgi-script should CLEAR
the BROWSER window or create a NEW HTML-PAGE or a NEW HEADER...
second possibility is if the user selected "NO" the browser should do a
simple redirect to a specific url...
claus pr|fer
pruefer@idnet.de
------------------------------
Date: Mon, 07 Jun 1999 14:52:20 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Bob Perini <perini@buffalo.edu>
Subject: Re: Split
Message-Id: <375C3F14.D2D38A74@atrieva.com>
Bob Perini wrote:
>
> I've got this directory name, and I need to split on a frontslash character
> here is what I have
>
> @directory=split (/ \ /,$directory1);
>
> This line will not work, it constantly gives me a syntax error. How do I put
> this character into the split function?
Split operates on a regular expression, not characters. The '\'
character is an escape character, so you need to escape it.
split(/\\/,$foo);
For all the exciting details on split(), see the perlfunc document that
came with your perl distribution. You can read up on regular
expressions in the perlre document.
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Mon, 7 Jun 1999 15:20:26 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Split
Message-Id: <MPG.11c5e587abcec6b3989b88@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7jhd0h$j93$1@prometheus.acsu.buffalo.edu> on Mon, 7 Jun 1999
17:14:20 -0400, Bob Perini <perini@buffalo.edu> says...
> I've got this directory name, and I need to split on a frontslash character
> here is what I have
>
> @directory=split (/ \ /,$directory1);
>
> This line will not work, it constantly gives me a syntax error. How do I put
> this character into the split function?
I'm glad that it gives you the syntax error constantly instead of
intermittently, but it shouldn't give it to you at all, because there is
no syntax error. You are asking for a split on two space characters.
@directory = split(/\//, $directory1);
or, more legibly,
@directory = split(m%/%, $directory1);
or, even more legibly,
@directory = split('/', $directory1);
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 07 Jun 1999 19:08:54 -0400
From: RABM@prodigy.net
Subject: Re: Split
Message-Id: <uaeubboc9.fsf@prodigy.net>
>>>>> "Bob" == Bob Perini <perini@buffalo.edu> writes:
Bob> I've got this directory name, and I need to split on a frontslash character
Bob> here is what I have
Bob> @directory=split (/ \ /,$directory1);
my @directory = split( '/', $directory1 );
More information by perldoc -f split
--
Vinny Murphy
perl -e "$_=1;(1x$_) !~ /^(11+)\1+$/ && push(@a,$_) while $_++ < 38;print pack qq(cccc),$a[0]*$a[-1],$a[2]*$a[-7],$a[2]*($a[0]**(($a[5]-$a[2])/$a[0])),(($a[1]**$a[0])*($a[0]**$a[1])), qq(\n)"
------------------------------
Date: Mon, 07 Jun 1999 21:17:51 GMT
From: Kurt Gray <grayku@my-deja.com>
Subject: Re: Strip "http" from URL's
Message-Id: <7jhctl$25c$1@nnrp1.deja.com>
This is kind of restrictive matching but fits your examples:
if ($URL =~ /http:\/\/([\w\.]+)(\/?\S*)$/i) {
$Domain = $1;
$RelativePath = $2;
}
Kurt
http://linux.davecentral.com/
>
> I've been trying to figure out a substitution string that will do the
> following:
>
> Given any URL such as:
> http://www.whatever.com/whatever/ or
> http://www.whatever.com/whatever or
> http://whatever.com/whatever/ or
> http://www.whatever.com/whatever/whatever.xxx or
> http://www.whatever.com/
>
> Will strip away everything after the actual website, so the output of
> the above examples would be:
>
> /whatever/
> /whatever
> /whatever/
> /whatever/whatever.xxx
> /
>
> Any help would be appreciated. I have from Web Sockets Programming
Perl
> book how to do the opposite, or to take a relative URL and assemble it
> to make an absolute, but I can't figure out the above.
>
> Thanks
> Charles
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 07 Jun 1999 15:03:55 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: The artistic license and perl:
Message-Id: <ylogirr7lg.fsf@windlord.stanford.edu>
Greg Bartels <gbartels@xli.com> writes:
> can anyone explain the difference between the Artistic License and the
> Library Gnu Public License? I'll do some digging tonight and see if i
> can find anything.
It would probably be faster to list the similarities. They're very
different licenses.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Mon, 7 Jun 1999 13:25:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Using string variable as name of subroutine to call
Message-Id: <5avgj7.0ao.ln@magna.metronet.com>
Tad McClellan (tadmc@metronet.com) wrote:
: [snip using code refs instead, repeated in code below ]
Uhhh. I forgot the code.
Here it is:
------------------------
#!/usr/bin/perl -w
use strict;
my %subs = (
A => \&codea,
B => \&codeb,
C => \&codec,
);
sub codea { print "A: @_\n" }
sub codeb { print "B: @_\n" }
sub codec { print "C: @_\n" }
my $data = 'foobar and baz';
foreach my $code_letter ( qw/A B C/ ) {
&{$subs{$code_letter}}($data);
}
------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 07 Jun 1999 16:44:02 -0700
From: Edwin Salgado <inca@incaic.engr.sgi.com>
Subject: Why doesn't this work: open(STDOUT, "| tee >>$file")
Message-Id: <375C5942.758B1ACB@incaic.engr.sgi.com>
Hello,
I want to append to a file and tee it as well.
But this didn't work:
open(STDOUT, "| tee >>$file") || .......
The append actually works, but the "| tee"
seems to be ignored.
Any suggestions/thoughts....
Thanks,
Edwin-
------------------------------
Date: Mon, 07 Jun 1999 22:19:13 GMT
From: bmetcalf@nortelnetworks.com (Brandon Metcalf)
Subject: Win32::NetResource::AddConnection()
Message-Id: <375c4535.520590389@paperboy.corpeast.baynetworks.com>
I need an example on the usage of AddConnection(). I'm trying
something like
Win32::NetResource::AddConnection('//host/share','password','user','x:')
|| die "$!\n";
which fails with an error stating no such file or directory. I'm sure
I have the usage wrong, but I don't have an example to go by.
Thanks,
Brandon
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5915
**************************************