[10929] in Perl-Users-Digest
Perl-Users Digest, Issue: 4530 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 2 00:07:24 1999
Date: Fri, 1 Jan 99 21:00:21 -0800
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, 1 Jan 1999 Volume: 8 Number: 4530
Today's topics:
Re: Difference between Perl version 5.003 and 5.00402?? bhoylma@uswest.com
Re: Difference between Perl version 5.003 and 5.00402?? <mpersico@erols.com>
Re: Executing telnet and getting data? (Rich)
no code posted (was Re: Question Concerning Arrays) <uri@home.sysarch.com>
Path under windows <makr44@dial.pipex.com>
Re: Perl equivalent of 'C' #include <ajonsson@csi.com>
Re: Perl Install on NT imchat@ionet.net
perl on NT <jewell@OnlineRAGE.com>
perl on NT <jewell@OnlineRAGE.com>
perl on NT <jewell@OnlineRAGE.com>
perl on NT <jewell@OnlineRAGE.com>
perl on NT <jewell@OnlineRAGE.com>
Re: perl on NT <mpersico@erols.com>
Re: perl on NT (Matthew Bafford)
perltoot use of $#_ (Steven Barbash)
Re: perltoot use of $#_ (Randal L. Schwartz)
Re: Question Concerning Arrays (Jeffrey Drumm)
Re: Question Concerning Arrays (Randal L. Schwartz)
Re: Question Concerning Arrays (Tad McClellan)
Re: Redirecting Output... <pmarkham@access.k12.wv.us>
Re: Redirecting Output... <jlarke@ans.net>
regexp imchat@ionet.net
Re: regexp <nospam_staffan@ngb.se>
Re: regexp imchat@ionet.net
Re: regexp <mds-resource@mediaone.net>
Re: simple regular expression. <nospam_staffan@ngb.se>
Re: Splitting Input File W/$INPUT_RECORD_SELECTOR (Tad McClellan)
Re: Splitting multiple |'s <ajonsson@csi.com>
Re: Syntactical weirdness? Or is it just me? <ajonsson@csi.com>
Re: Syntactical weirdness? Or is it just me? <mpersico@erols.com>
Re: Syntactical weirdness? Or is it just me? (Matthew Bafford)
Re: Thanks! and happy new year! <mpersico@erols.com>
Re: win32 install woes. ( win98 ) imchat@ionet.net
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 02 Jan 1999 03:41:04 GMT
From: bhoylma@uswest.com
Subject: Re: Difference between Perl version 5.003 and 5.00402???
Message-Id: <76k4gg$r99$1@nnrp1.dejanews.com>
In article <DaTi2.3139$OU.3462@nnrp2.clara.net>,
"Jules" <julius@clara.net> wrote:
> Dear all, I wrote a perl program that works on my PC running the CPAN perl
> compiler 5.00402 and then tried running the same code on UNIX using
> perl5.003 but it doesn't work as expected. Is there anything major between
> the 2 version such as handling of OOP stuff?
>
Review the various Changes* files included in the distribution. They contain
detailed change descriptions.
Peace.
--
Bruce W. Hoylman (303-541-6557) -- bhoylma@uswest.com ._ 0
- __0 "I intend to live forever... /\/\ /\ / //\.
- - - _-\<,_ so far, so good." /~/~~\/\/~~\ ' \>> |
- __(_)/_(_)_____________________________/\ / \ \/\ \________\\ `_
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 01 Jan 1999 23:25:49 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Difference between Perl version 5.003 and 5.00402???
Message-Id: <368D9FCD.62CD1F00@erols.com>
perldoc perldelta
--
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2
------------------------------
Date: Sat, 02 Jan 1999 00:43:43 GMT
From: richm@ucesucks.rochester.rr.com (Rich)
Subject: Re: Executing telnet and getting data?
Message-Id: <slrn78qr43.q9t.richm@ll.aa2ys.ampr.org>
On Fri, 01 Jan 1999 16:06:19 -0500, Arum Han <hana@email.uc.edu> wrote:
>Hello
>
>I need to telnet to a search engine and I'm wondering if I can send data
>and
>get result using perl. The site works as following.
>telnet searchsite(ip address)
>AT prompt, I have to type 'whois'.
>Then, I have to type in the string which I want to search and the search
>engine
>gives the result by text.
>Can I do the above function by just passing the string which I want to
>search
>to the perl program?
>Please let me know.
>
perldoc Net::Telnet
--
Rich Mulvey
http://mulvey.dyndns.com
Amateur Radio: aa2ys@wb2wxq.#wny.ny.usa
------------------------------
Date: 01 Jan 1999 19:54:43 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: no code posted (was Re: Question Concerning Arrays)
Message-Id: <x77lv6fq98.fsf@home.sysarch.com>
>>>>> "G" == GSX <gsx97@usa.net> writes:
G> line one|data
G> line two|data
G> line three|data
G> The first field in each line is a username, so being indented is causing
G> the username to not match the form input. Of course, I have tried to use
G> a regex to replace every space on every line with nothing, but it will
G> not remove those beginning spaces.
perhaps your regex is not correct, but we can't tell because you
didn't post it. removing blanks from the beginning of a line is
trivial. but i won't answer it since that is not the source of your
problem. why the blanks are getting there is.
G> Does anybody know why this happens, and what the characters actually are
G> if they aren't spaces?
how can we unless we seen the code and/or the actual raw file data (not
printed text).
and now for something completely different:
i alwasy wonder why we get so many questions here assuming we can divine
the answer without any code to look at. "my program is not working, perl
must be broken" or "can you fix my program" and neither with any
relevant code. what are we doing to attract these posts?
and of course the subjects are bogus. what does this post have to do
with arrays? it asks about regexes and file data, but nothing about
arrays except for the part that works and that is the only (trivial)
code posted.
and people wonder why the perl newgroups are so loving and joyful all
the time. just like the recent new year's post thanking us for our
wonderful attitudes. these questions just beg sarcasm and snooty
responses. forget about RTFM or RTFFAQ (sic), how about having the
newbies post the broken code! we can help but as much as you put us
(whoever us is) on those perl pedestels, we are not gods (except larry
wall, who IS a demigod) and we can't read your little minds and figure
out what is going on in there.
sometimes i feel we should make c.l.p.misc a registered group like
moderated so at least all newbies will have to demonstrate they have
some knowledge of where the perl resources are and how to post useful
questions. i know new posters get some spammish stuff (when i post from
a new work address i get it), but they mostly ignore it. they should
have to send back a working hello world program (maybe randomly
generated so you can't copy) just to show they are functional beings.
well, this sarcastic answer has turned into a dennis miller type rant
(but not as long or esoterically linked). must be the new year getting
to me. i like solving problems. perl programming is like doing fun
puzzles. but seeing dumb stuff over and over again gets really
dull. maybe that's why many of the cognesceti here have left or get very
nasty sometimes. the current newbie is the messenger and gets
flamed. all we ask of all of you is one simple thing,
THINK! THINK! THINK!
this means the subject, the topic (about perl not servers), posting
relevant info (code, data, not your mother-in-law's dress size), asking
clear questions about your problem (not asking for all the work to be
done for you), etc.
this is an (supposedly) intellegent community but the entrance barriers
have gotten to limbo ending levels (hey dennis would like that
one!). any kid with his redmondware box can be a web master and now u r a
programmer by golly! i wish lawyers and doctors had this kind of
following sometimes. watch the ama and the bar crack down on all those
wannabes. just because you chase an ambulence for fun doesn't make you a
johnnie cochrane. you actually have to able to win lost cases or know
how something about programming to do what we do. yes, you can fiddle
with it but it is using your brain and not playing with toys, however
much fun it may seem. so think a little. think a lot. think some more. i
earn mucho $ just sitting on my duff, thinking. sometimes i even type
some code in and get it to run. but that is only part of my
work. thinking is the rest.
this is not to stop you from programming or learning it. just don't
assume it is an easy thing to do well and that we perl hackers want to
help every last POB newbie on the planet. we love this language and want
to support it and its community but that is the key word of the day
kiddies, community. this is open source baby, you have to follow some
well intentioned guidelines be part of the gang. posting dumb subjects
and no code is not allowed, acceptable, or liked. hence the sarcasm and
other fun comments. actually i enjoy some of tom c. and other's flames
just for the fun of it and to warm up my attic in this cold weather.
'nuff for now. send your responses to dev-null@bitbucket.org.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Sat, 02 Jan 1999 03:23:13 +0000
From: Andrew Burns <makr44@dial.pipex.com>
Subject: Path under windows
Message-Id: <368D9121.7FA01CF1@dial.pipex.com>
Hi,
I'm having difficulty with the path under windows 95.
I have perl installed at c:/perl/bin/perl. I can run scripts okay from
the Dos prompt. Now, I managed to get the following little script
running correctly, but when I came back an hour later, it was asking if
I wanted to save the file, rather than just running it, or it runs it at
the dos prompt. I've tried altering the path, which fixed it before, but
to no effect, and I can't think why it'd have changed anyway.
Could anyone tell me what is wrong?
#! c:\perl\bin\perl
($fieldname, $comment) = split (/=/, $ENV {'QUERY_STRING'});
$comment =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex($1))/eg;
$comment =~ s/\+/" "/eg;
print "Content-type: text/html\n\n";
print "<html><body> your comments: $comment <br>\n";
print "</body>\n</html>";
------------------------------
Date: Fri, 1 Jan 1999 20:00:50 -0600
From: "AJ" <ajonsson@csi.com>
Subject: Re: Perl equivalent of 'C' #include
Message-Id: <uyamtOfN#GA.131@nih2naac.prod2.compuserve.com>
Sure, it's called "require".
ex:
require prog1.pl;
AJ
Richard Gordon wrote in message <76g6mi$2t6$1@mendelevium.btinternet.com>...
>I am new to perl and wonder if there an equivalent of 'C' #include in perl.
>I am trying to do something like the following
>
>#prog1.pl
>
>$VAR1 = 1 ;
>$VAR2 = 2 ;
>
>#include "prog2.pl"
>
>
>
>
>
>
>
>
>
------------------------------
Date: Sat, 02 Jan 1999 01:50:05 GMT
From: imchat@ionet.net
Subject: Re: Perl Install on NT
Message-Id: <368d7a7f.27747729@news.ionet.net>
Gotta agree here. I've installed the Activestate package,
which comes lacking any modules, and ended up getting the binary from;
http://www.perl.com/CPAN-local/ports/index.html#win32
This package comes with most of the good modules already so
you don't have to go through the crap of trying to install them with
the activestate package. Much better IMO.
On Fri, 1 Jan 1999 15:47:24 -0600, "AJ" <ajonsson@csi.com> wrote:
>The easiest way to to get a binary distribution of Perl for Win32
>from www.perl.com and just execute it with winzip, it will unzip and
>install. Took me 2 minutes the other day.
>
>AJ
>
>Al and Linda Adams wrote in message <76esni$7ki$1@eve.enteract.com>...
>>Has anyone ever installed Perl from Windowsa NT Resource kit for
>>workstations? What is needed as far as any compilers, and so on. I would
>>appreciate help.
>>
>>Thanks,
>>
>>Al Adams
>>
>>
>
>
------------------------------
Date: Fri, 01 Jan 1999 23:13:03 -0500
From: "Ronnie D. Jewell" <jewell@OnlineRAGE.com>
Subject: perl on NT
Message-Id: <368D9CCF.29BD4A51@OnlineRAGE.com>
Hi all,
I am trying to get a script to run on NT.. the script works fine on
unix...
seems like this line is causing all the problems
use CGI qw(:standard);
Any suggestions??
--
RAGE Enterprises
Ronnie D. Jewell jewell@onlinerage.com
voice: 304-525-1898
http://www.onlinerage.com
------------------------------
Date: Fri, 01 Jan 1999 23:12:19 -0500
From: "Ronnie D. Jewell" <jewell@OnlineRAGE.com>
Subject: perl on NT
Message-Id: <368D9CA3.4D4FA099@OnlineRAGE.com>
Hi all,
I am trying to get a script to run on NT.. the script works fine on
unix...
seems like this line is causing all the problems
use CGI qw(:standard);
Any suggestions??
--
RAGE Enterprises
Ronnie D. Jewell jewell@onlinerage.com
voice: 304-525-1898
http://www.onlinerage.com
------------------------------
Date: Fri, 01 Jan 1999 23:17:04 -0500
From: "Ronnie D. Jewell" <jewell@OnlineRAGE.com>
Subject: perl on NT
Message-Id: <368D9DC0.415CDD5D@OnlineRAGE.com>
Hi all,
I am trying to get a script to run on NT.. the script works fine on
unix...
seems like this line is causing all the problems
use CGI qw(:standard);
Any suggestions??
--
RAGE Enterprises
Ronnie D. Jewell jewell@onlinerage.com
voice: 304-525-1898
http://www.onlinerage.com
------------------------------
Date: Fri, 01 Jan 1999 23:15:22 -0500
From: "Ronnie D. Jewell" <jewell@OnlineRAGE.com>
Subject: perl on NT
Message-Id: <368D9D59.E41FD7D7@OnlineRAGE.com>
Hi all,
I am trying to get a script to run on NT.. the script works fine on
unix...
seems like this line is causing all the problems
use CGI qw(:standard);
Any suggestions??
--
RAGE Enterprises
Ronnie D. Jewell jewell@onlinerage.com
voice: 304-525-1898
http://www.onlinerage.com
------------------------------
Date: Fri, 01 Jan 1999 23:40:17 -0500
From: "Ronnie D. Jewell" <jewell@OnlineRAGE.com>
Subject: perl on NT
Message-Id: <368DA331.165E3CD2@OnlineRAGE.com>
Hi all,
I am trying to get a script to run on NT.. the script works fine on
unix...
seems like this line is causing all the problems
use CGI qw(:standard);
Any suggestions??
--
RAGE Enterprises
Ronnie D. Jewell jewell@onlinerage.com
voice: 304-525-1898
http://www.onlinerage.com
------------------------------
Date: Fri, 01 Jan 1999 23:41:30 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: perl on NT
Message-Id: <368DA37A.FA7231F9@erols.com>
For starters, four posts are not needed.
"Ronnie D. Jewell" wrote:
>
> Hi all,
>
> I am trying to get a script to run on NT.. the script works fine on
> unix...
> seems like this line is causing all the problems
>
> use CGI qw(:standard);
>
> Any suggestions??
>
> --
> RAGE Enterprises
> Ronnie D. Jewell jewell@onlinerage.com
> voice: 304-525-1898
> http://www.onlinerage.com
--
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2
------------------------------
Date: Fri, 1 Jan 1999 23:43:25 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: perl on NT
Message-Id: <MPG.10f76df73515dfb4989774@news.scescape.net>
In article <368D9CA3.4D4FA099@OnlineRAGE.com>, jewell@OnlineRAGE.com
says...
=> Hi all,
=>
=> I am trying to get a script to run on NT.. the script works fine on
=> unix...
=> seems like this line is causing all the problems
=>
=> use CGI qw(:standard);
=>
=> Any suggestions??
1) Post only 1 time.
2) Post the error messages you are getting, the version of Perl you are
using, the output you get, the output you expect, what you've tried,
and what you think is wrong.
3) Have a Happy New Year!
HTH!
--Matthew
------------------------------
Date: Fri, 1 Jan 1999 21:24:53 -0500
From: stevenba@ccpl.carr.org (Steven Barbash)
Subject: perltoot use of $#_
Message-Id: <MPG.10f74d7c5e068dc2989689@www.siast.sk.ca>
In perltoot.htm is a usage of $#_
ie.
sub name { &{ $_[0] }("NAME", @_[ 1 .. $#_ ] ) }
I have not been able to find any definition of this variable.
Can anybody help with this?
Does #_ have a special usage? or $# ?
What documentation has this info?
Thanks.
Steve
------------------------------
Date: 01 Jan 1999 19:51:14 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: perltoot use of $#_
Message-Id: <m1ogoiz619.fsf@halfdome.holdit.com>
>>>>> "Steven" == Steven Barbash <stevenba@ccpl.carr.org> writes:
Steven> In perltoot.htm is a usage of $#_
Steven> ie.
Steven> sub name { &{ $_[0] }("NAME", @_[ 1 .. $#_ ] ) }
Steven> I have not been able to find any definition of this variable.
Steven> Can anybody help with this?
Steven> Does #_ have a special usage? or $# ?
Steven> What documentation has this info?
"perldoc perldata" =>
Scalar values are always named with '$', even when
referring to a scalar that is part of an array. It works
like the English word "the". Thus we have:
$days # the simple scalar value "days"
$days[28] # the 29th element of array @days
$days{'Feb'} # the 'Feb' value from hash %days
$#days # the last index of array @days
Notice the last line there. So $#_ is the last index of array @_.
I presume you have seen @_. :)
print "Just another Perl manpage reader,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sat, 02 Jan 1999 00:31:30 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Question Concerning Arrays
Message-Id: <368e630d.123307502@news.mmc.org>
[posted and mailed]
On Fri, 01 Jan 1999 18:10:25 -0500, GSX <gsx97@usa.net> wrote:
>Greetings!
>
>I have read the contents of a pipe delimited file into an array. We'll
>call it @array. Then, after I edit the lines needed using a
>
>foreach $line (@array) {
>do this stuff...
>}
>
>I print the revised array back to the file. Here is my problem:
>
>After I print the data back, the first line gets placed fine, but every
>line after that ends up being indented. For instance:
>
>line one|data
> line two|data
> line three|data
(snip)
Without seeing the code, I can't *really* be sure, but I suspect you have
something like the following for your routine to write the array:
foreach (@array)
{
print FILE $_,"\n ";
^
Note the space here
}
This would certainly produce results similar to what you're seeing, and can
be easy to miss.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: 01 Jan 1999 16:58:40 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Question Concerning Arrays
Message-Id: <m1hfua1oe7.fsf@halfdome.holdit.com>
>>>>> "GSX" == GSX <gsx97@usa.net> writes:
GSX> After I print the data back, the first line gets placed fine, but every
GSX> line after that ends up being indented. For instance:
GSX> line one|data
GSX> line two|data
GSX> line three|data
Almost certainly you have done something like:
print "@a"
when you meant to say
print @a
and *why* these are different are left as an exercise to you. :)
print "Just another Perl trainer,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Fri, 1 Jan 1999 21:54:01 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Question Concerning Arrays
Message-Id: <p85k67.3nb.ln@magna.metronet.com>
GSX (gsx97@usa.net) wrote:
: I have read the contents of a pipe delimited file into an array. We'll
: call it @array. Then, after I edit the lines needed using a
[snip]
: I print the revised array back to the file. Here is my problem:
: After I print the data back, the first line gets placed fine, but every
: line after that ends up being indented. For instance:
: line one|data
: line two|data
: line three|data
: The first field in each line is a username, so being indented is causing
: the username to not match the form input. Of course, I have tried to use
: a regex to replace every space on every line with nothing, but it will
: not remove those beginning spaces.
: Does anybody know why this happens,
I'm holding my forehead against the monitor to devine what
your code might say...
...
... it is all very murky...
...
Ah ha! I betcha I know what the problem is.
You really lucked out that my psyche is atuned at this
particular moment.
You should post code if you want help fixing code...
: and what the characters actually are
: if they aren't spaces?
I'm betting that they _are_ spaces...
... and that they were inserted due to the $" special variable
(look it up in perlvar)
Find a line that looks like this:
print "@array";
And change it to look like this:
print @array;
Don't _ask_ for "extra" stuff when you don't _want_ extra stuff.
(using double quotes instead of single quotes is
asking for extra stuff)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 01 Jan 1999 22:35:23 -0500
From: Penn Markham <pmarkham@access.k12.wv.us>
Subject: Re: Redirecting Output...
Message-Id: <368D93FB.46D266D6@access.k12.wv.us>
First of all, I'd just like to thank everyone who helped me. I
realize that while my question may have seemed easy to you, it certainly
was difficult for myself to find the answer in my varied selection of
Perl books. I admit that I didn't read all six of them back to back,
taking notes, highlighting, photocopying, memorizing, etc., but I did
spend a large amount of time searching through each and every one before
I posted. I apologize if anyone found my remarks to be offensive to the
Perl programming language or to themselves, since it seems that someone
obviously did. I believe that my exact words were 'it seems...', not
'it is', thus indicating a degree of uncertainty. In my work with
computers, I have found that few things are ever certain, and that there
is usually more than one solution to any given problem. Therefore, I am
always careful when I write about this 'sensitive' topic in hopes that
no one will be offended. Again, my apologies...
PENN
------------------------------
Date: 01 Jan 1999 22:48:41 -0500
From: Jason Larke <jlarke@ans.net>
Subject: Re: Redirecting Output...
Message-Id: <vatvhiqcp2e.fsf@anthem.aa.ans.net>
>>>>> On Thu, 31 Dec 1998 17:15:38 -0500, Penn Markham
>>>>> <pmarkham@access.k12.wv.us> said:
PM> I know that there is a grep function in Perl, but it doesn't
PM> appear to do what I want. Does anybody know what I can do to
PM> make this work? Thanks,
It almost certainly can do what you want. It works on arrays
instead of files, but reading a file into an array is no great
trick. Of course, this can give you a very large array.
Alternately, you can open the file and read lines, checking them
with the matching operator.
One of Perl's best things is regular expressions; calling a
seperate program just to find lines matching a regexp totally
ignores the power of Perl. You might as well be writing a shell
script.
--
Jason Larke- jlarke@ans.net- Just a happy little pimp for mayhem
http://www.nnaf.net/~jlarke/ Send mail for PGP public key.
I don't speak for ANS or the international communist conspiracy.
"People change, and smile: but the agony abides."-T.S. Eliot, The Dry Salvages
------------------------------
Date: Sat, 02 Jan 1999 01:34:07 GMT
From: imchat@ionet.net
Subject: regexp
Message-Id: <368d73ea.26062245@news.ionet.net>
I'm really new to regexps and even though I've been studying
them, I can't seem to formulate one that will turn something like
this;
c:\whatever\whatever\whatever\image.gif
TO
image.gif
I need to get rid of the path info and just display the image
name. I can't formulate it because the path could be several layers
deep and unknown to me. I just want to omit everything before the last
backslash.
I wouldn't bore you with my primitive attempts except that
you'll probably want an attemt, however bad. Here's what I have;
$in{'field'} =~
s/[a-zA-Z]:\\[a-zA-Z0-9\\-\\]\\[a-zA-Z0-9\\-\\]^.gif/^.gif/g;
Even I can see the error in this logic, but I'm at a loss as
to the proper syntax.
Any help appreciated. I usually do pretty good once I'm put in
the right direction.
------------------------------
Date: Sat, 02 Jan 1999 03:04:36 +0100
From: Staffan Liljas <nospam_staffan@ngb.se>
Subject: Re: regexp
Message-Id: <368D7EB4.F8AA2579@ngb.se>
Hello!
If you have
$path = "c:\whatever\whatever\whatever\image.gif";
do
$path = ( $path =~ /([^\\]+)$/ );
or if you have to use s///,
$path =~ s/.*\\([^\\]+)$/$1/;
Sometimes it pays of thinking of what you DON'T have rather than what
you have. In this case [^?] Where ? is something you don't want to match
is an exellent solution. The $ just before the / matches the end of the
line. The $1 is of course what you matched in the first case - the
things within parenthesis.
Good Luck!
------------------------------
Date: Sat, 02 Jan 1999 03:00:47 GMT
From: imchat@ionet.net
Subject: Re: regexp
Message-Id: <368d8ac3.31911055@news.ionet.net>
Wow, that works great.
I'm reminded just now of a conference I went to featuring
Larry Wall and other notables where they said just about the same
thing. I was really just beginning to learn then so was afraid to even
ask a question.
Thanks alot. Now I'll try to take this apart and learn from it!
On Sat, 02 Jan 1999 03:04:36 +0100, Staffan Liljas
<nospam_staffan@ngb.se> wrote:
>Hello!
>
>If you have
>
> $path = "c:\whatever\whatever\whatever\image.gif";
>
>do
>
> $path = ( $path =~ /([^\\]+)$/ );
>
>or if you have to use s///,
>
> $path =~ s/.*\\([^\\]+)$/$1/;
>
>Sometimes it pays of thinking of what you DON'T have rather than what
>you have. In this case [^?] Where ? is something you don't want to match
>is an exellent solution. The $ just before the / matches the end of the
>line. The $1 is of course what you matched in the first case - the
>things within parenthesis.
>
>Good Luck!
------------------------------
Date: Fri, 01 Jan 1999 21:18:05 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: regexp
Message-Id: <368D8FED.9B26CCDE@mediaone.net>
What about the simple:
my $path = 'c:\whatever\whatever\whatever\image.gif';
$path =~ s/.*\\//;
print $path, "\n";
Staffan Liljas wrote:
>
> Hello!
>
> If you have
>
> $path = "c:\whatever\whatever\whatever\image.gif";
>
> do
>
> $path = ( $path =~ /([^\\]+)$/ );
>
> or if you have to use s///,
>
> $path =~ s/.*\\([^\\]+)$/$1/;
--
Best Regards,
mds
mds resource
888.250.3987
"Dare to fix things before they break . . . "
"Our capacity for understanding is inversely proportional to how much we
think we know. The more I know, the more I know I don't know . . . "
------------------------------
Date: Sat, 02 Jan 1999 03:18:07 +0100
From: Staffan Liljas <nospam_staffan@ngb.se>
Subject: Re: simple regular expression.
Message-Id: <368D81DF.414B6B35@ngb.se>
Try my favourite
$in{"fField"} =~ s!<([^>]+)>.*! <a href="$1"
target=\"_blank\">$1<\/a>!g;
------------------------------
Date: Fri, 1 Jan 1999 21:27:27 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Splitting Input File W/$INPUT_RECORD_SELECTOR
Message-Id: <vm3k67.5jb.ln@magna.metronet.com>
UMD Vikram (umdvikram@aol.com) wrote:
: Someone helped me by pointing out that to split an input file with three
: different files merged together (split by a line like ******) could be done
: using $INPUT_RECORD_SELECTOR.
Perl does not have an $INPUT_RECORD_SELECTOR.
It does, however, have an $INPUT_RECORD_SEPARATOR ( aka $/ ).
Now that you know how it is spelled, you can look it up in
the 'perlvar' man page and all will be revealed.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 1 Jan 1999 21:36:52 -0600
From: "AJ" <ajonsson@csi.com>
Subject: Re: Splitting multiple |'s
Message-Id: <#vNFZEgN#GA.259@nih2naac.prod2.compuserve.com>
Your logic is fine, but try the split statement like this: split(/\|/,
$reseller)
Good luck!
AJ
Groovy94 wrote in message <19981227192849.08200.00002458@ng-fb1.aol.com>...
>I am trying to split multiple "|" characters into seperate variables. I
have
>one line in a database for a person, containing all their information, and
I am
>trying to sort it into variables, so I can work with it. Here is the code I
>have, but it only split's the first "|".
>
>$id,$first_name,$last_name,$address,$city,$state,$postal_code,$country,$em
>ail,$url,$password) = split('|', $reseller);
>
>an example of what a line I am trying to work with would look like is
below:
>
>12|Bob|Smith|2738 Bob Lane|New
>Orleans|LA|70554|US|bob@bobsite.com|http://www.bobsite.com|sdsdskldhs(encr
>ypted)
>
>Regards,
>GIl Hildebrand, Jr.
>Email: groovy94@aol.com
>ICQ UIN: 16678754
------------------------------
Date: Fri, 1 Jan 1999 20:22:57 -0600
From: "AJ" <ajonsson@csi.com>
Subject: Re: Syntactical weirdness? Or is it just me?
Message-Id: <OnWTEbfN#GA.259@nih2naac.prod2.compuserve.com>
I think this line
print reverse($string);
doen't perform the reverse function before it prints, but:
$bstring=reverse($string);
uses the reverse function as it was intended. A good lesson for all of us
(and I include myself, for sure), don't try to print a function, just the
the variable.
Good braintease!
AJ
Brandon Burt wrote in message <767ln4$fpt$1@news.xmission.com>...
>I'm trying to find the deep, inner meaning in this weirdness. This snippet:
>
>$string='sdrawkcab';
>print reverse($string);
>$bstring=reverse($string);
>print $bstring;
>
>produces the string: "sdrawkcabbackwards", and not "backwardsbackwards"
>which seems to be the intuitive thing. While I know I shouldn't expect Perl
>to always do the intuitive thing, it makes me wonder if I'm missing a
subtle
>point which might bear on other Perl-related issues.
>
>-Brandon Burt
>
>
>
------------------------------
Date: Fri, 01 Jan 1999 23:24:24 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Syntactical weirdness? Or is it just me?
Message-Id: <368D9F78.73F44C1A@erols.com>
try print(reverse($string))
AJ wrote:
>
> I think this line
> print reverse($string);
> doen't perform the reverse function before it prints, but:
> $bstring=reverse($string);
> uses the reverse function as it was intended. A good lesson for all of us
> (and I include myself, for sure), don't try to print a function, just the
> the variable.
>
> Good braintease!
> AJ
> Brandon Burt wrote in message <767ln4$fpt$1@news.xmission.com>...
> >I'm trying to find the deep, inner meaning in this weirdness. This snippet:
> >
> >$string='sdrawkcab';
> >print reverse($string);
> >$bstring=reverse($string);
> >print $bstring;
> >
> >produces the string: "sdrawkcabbackwards", and not "backwardsbackwards"
> >which seems to be the intuitive thing. While I know I shouldn't expect Perl
> >to always do the intuitive thing, it makes me wonder if I'm missing a
> subtle
> >point which might bear on other Perl-related issues.
> >
> >-Brandon Burt
> >
> >
> >
--
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2
------------------------------
Date: Fri, 1 Jan 1999 23:31:39 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Syntactical weirdness? Or is it just me?
Message-Id: <MPG.10f76b3a9387518b989773@news.scescape.net>
In article <368D9F78.73F44C1A@erols.com>, mpersico@erols.com says...
=> try print(reverse($string))
Or don't.
In list context reverse just flips the order of the arguments passed to
it. So the list ($string) is reversed to ($string) -- ie: it's a nop.
print scalar reverse $string;
or
print scalar(reverse($string));
will work, however.
HTH!
--Matthew
------------------------------
Date: Fri, 01 Jan 1999 21:31:02 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Thanks! and happy new year!
Message-Id: <368D84E6.2A723B3A@erols.com>
Quiz time.
Q: Describe the quote below:
1) Sarcasm
2) Drunken Stupor.
3) Truth - in which case, I've been mising it.
Gregg Silk wrote:
>
> Thanks to everyone so far. I am amazed at what a helpful and polite group this
> is. I have seen newgroups for other languages where it seems like some people
> spend their whole so-called lives flaming newbies and telling them to post
> elsewhere. Of course, I always took those flamers as an encouraging sign, since
> I figured I'd soon be beating them up and taking their lunch money. But it's
> also very encouraging to know there are lots of decent folks out there as
> well. Happy New Year!
>
> Gregg
--
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2
------------------------------
Date: Sat, 02 Jan 1999 02:00:11 GMT
From: imchat@ionet.net
Subject: Re: win32 install woes. ( win98 )
Message-Id: <368d7c91.28277420@news.ionet.net>
Get rid of PWS and get a real web server! For ease of use, get Xitami
web server from imatix.com
Trouble with MS products is they want you to change the
registry to activate perl.[MS doesn't like open source] If you want to
play with your machine go ahead and try. With Xitami you don't even
have to change the shebang line from #!/usr/bin/perl for it to
work!!!!
On Fri, 1 Jan 1999 16:44:21 -0500, "Jennifer Whiteside"
<jennifer.whiteside@reedtech.com> wrote:
>i am having the same exact problem. have you heard anything yet?
>
>c.s. wrote in message <76c8uc$390$1@remarQ.com>...
>>hello,
>>
>>I am haveing trouble getting Perl to work on my machine. I can run scipts
>>from the command line just fine, but i can't invoke them via a web server.
>>
>>I have checked the FAQs, but I am somewhat new to this, so I may have
>missed
>>something.
>>
>>My system:
>>
>>Win98
>>Microsoft PWS.
>>
>>
>>The problem:
>>
>>While installing perl (build 507 and 508), the installer complains several
>>times
>>that it "Cannot Access The IIS MetaBase.... continue installation ? y/n ".
>>I clicked "yes" to continue all of the times. (It also suggested that I
>>restart
>>the machine and try again, but this did not help.)
>>
>>Perl was installed to c:\perl\bin. I am able to run scripts from
>>command line just fine, however the webserver did not seem to configured to
>>recognize perl yet.
>>
>>At this point, I added the .pl(x) => "c:\perl\bin\perl.exe(perlIS.dll) %s
>>%s" keys to: HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\Script
>>Map
>>
>>Now, the server seems to call Perl, but one of two things will happen when
>I
>>try to request a script via the web server.
>>
>>When requesting a ".pl" file:
>>The server seems to stall, returning no information to the browser. Hitting
>>"Ctrl-Alt-Delete" reveals that there is a process by the name of "Perl"
>>running at the moment. Eventually, forcing this process to quit will cause
>>the server to send a generic CGI error to the browser.
>>
>>When requesting a ".plx" file": (perlIS.dll)
>>The server will return a page that says "One of the library files needed to
>>run this application cannot be found. "
>>
>>
>>
>>Thank you for your time,
>>cs2400@hotmail.com
>>
>>
>>
>>
>>
>
>
------------------------------
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 4530
**************************************