[17785] in Perl-Users-Digest
Perl-Users Digest, Issue: 5205 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 27 11:05:31 2000
Date: Wed, 27 Dec 2000 08:05:10 -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: <977933110-v9-i5205@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Dec 2000 Volume: 9 Number: 5205
Today's topics:
Re: =~ operator (Tad McClellan)
Re: =~ operator <joe+usenet@sunstarsys.com>
Re: Any good Perl books? <admingod@stargate.net>
HELP with https <artax@shineline.it>
Re: HELP with https (Michael Fuhr)
Re: How do I 'PREVENT' dos window popping up when "mysc (Joe Smith)
Re: How to delete items from an array? <bart.lateur@skynet.be>
Re: How to delete items from an array? georgebailey@my-deja.com
Re: How to delete items from an array? (Rafael Garcia-Suarez)
Re: How to delete items from an array? (Tad McClellan)
Re: How to have three dimentional array (Tad McClellan)
indexing web servers's content <-nancy-@libero.it>
Re: Language evolution C->Perl->C++->Java->Python (Is P <blair@object-arts.com>
Open a big text file ( large than 200MB ) ghorghor@my-deja.com
Re: Open a big text file ( large than 200MB ) nobull@mail.com
Re: Open a big text file ( large than 200MB ) <JD@Tallorno.net>
Re: Open a big text file ( large than 200MB ) (Tad McClellan)
Our question - Possible Legacy code question... <joejava@dragonat.net>
Re: Parsing (Martien Verbruggen)
Re: Parsing <SiStie@nuclear-network.de>
Re: Parsing (Eric Bohlman)
perl on win 98 <CHRISVAL@bigpond.com.au>
Re: perl on win 98 <bowman@montana.com>
Re: perl on win 98 schnurmann@my-deja.com
Re: perl on win 98 (chr1st1an)
Re: perl on win 98 <CHRISVAL@bigpond.com.au>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 Dec 2000 07:27:35 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: =~ operator
Message-Id: <slrn94jo1n.e1u.tadmc@magna.metronet.com>
Andrew N. McGuire <anmcguire@ce.mediaone.net> wrote:
>>>>>> "MC" == Michael Carman <mjcarman@home.com> writes:
>
>MC> Martin Schmidt wrote:
>>>
>>> What is the =~ operator called?
>>> I'm reading 'Learning Perl' and they just call it the
>>> =~ operator.
>
>MC> I generally refer to it as the 'binding' operator, as it binds an
>MC> variable to a regexp.
>
> being a bit pedantic, but:
>
> s/regexp/pattern/;
Well, if we're going to pull out pedantry, then that doesn't
really help, and there is yet another part that needs changing.
s/regexp/pattern/ doesn't really get there, because a regular
expression is just a representation of a pattern. Changing that
word does not make the statement more valuable for
teaching/understanding.
One thingie being "bound" is the "pattern match _operator_",
or "pattern match" (with the "operator" understood).
The other thing that needs pedantic attention is "variable". There
is no requirement that the string to be matched against be in a variable.
The other thingie being "bound" is the string to match against.
Strings are scalar values.
So then, we get to:
I generally refer to it as the 'binding' operator, as it binds a
scalar value to a pattern match operator.
That sounds kinda familiar...
---------------------------
=head2 Binding Operators
Binary "=~" binds a scalar expression to a pattern match.
---------------------------
We didn't re-answer a FAQ here, but we did end up spending a bit
of time deriving something that has already been derived :-)
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 27 Dec 2000 10:45:33 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: =~ operator
Message-Id: <m3vgs5amw2.fsf@mumonkan.sunstarsys.com>
tadmc@metronet.com (Tad McClellan) writes:
> ---------------------------
> =head2 Binding Operators
>
> Binary "=~" binds a scalar expression to a pattern match.
> ---------------------------
$exclude !~ /pattern|interpolated/,
$so =~ y/$exclude/transliteration?/
The pedantry in perlop continues:
Certain operations search or modify the string $_ by
default. This operator makes that kind of operation work
on some other string. The right argument is a search
pattern, substitution, or transliteration. The left
argument is what is supposed to be searched, substituted,
or transliterated instead of the default $_. The return
value indicates the success of the operation.
...
--
Joe Schaefer
------------------------------
Date: Wed, 27 Dec 2000 09:36:30 -0500
From: AdminGod <admingod@stargate.net>
Subject: Re: Any good Perl books?
Message-Id: <3A49FE6E.FEE07872@stargate.net>
--------------4070B4FBD1528C3D19EB5D5E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I agree that O'Reily is not the only reference nor is it one of the
better ones out there. But considering the availability and the ease of
use I would suggest getting at least one and 'form your own opinion.'
I personally don't like buying "dead trees" but sometimes that is
unavoidable. So to solve that I purchased "The Perl CD Bookshelf" and
put the whole thing on my HD. Start up the web server and #! I have my
6 book reference without deleting a few trees. I purchased it from
bookpool.com and got a great discount off the retail price. I will make
it public for all to take a look at for a while.
(gangrel.ws.pitdc1.stargate.net)
--
"The box said 'Windows 95 or better,' so I wrote my own OS in one line of Perl"
--------------4070B4FBD1528C3D19EB5D5E
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I agree that O'Reily is not the only reference nor is it one of the better
ones out there. But considering the availability and the ease of
use I would suggest getting at least one and 'form your own opinion.'
<p>I personally don't like buying "dead trees" but sometimes that is unavoidable.
So to solve that I purchased "The Perl CD Bookshelf" and put the whole
thing on my HD. Start up the web server and #! I have my 6 book reference
without deleting a few trees. I purchased it from bookpool.com and
got a great discount off the retail price. I will make it public
for all to take a look at for a while. (gangrel.ws.pitdc1.stargate.net)
<br>
<br>
<pre>--
"The box said 'Windows 95 or better,' so I wrote my own OS in one line of Perl"</pre>
</html>
--------------4070B4FBD1528C3D19EB5D5E--
------------------------------
Date: Wed, 27 Dec 2000 11:43:53 +0100
From: "Federico" <artax@shineline.it>
Subject: HELP with https
Message-Id: <3a49c83c$1_1@news.telnetwork.it>
Please there is somebody who can help me with https protocol? I have to
intorragate a search engine internal to a site. It's action/url starts with
http but the response is an error: "501 (Not Implemented) Protocol scheme
'https' is not supported". So the question is: using LWP::UserAgent; how can
i solve this problem???
Thank you all!
Federico.
------------------------------
Date: 27 Dec 2000 08:21:11 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: HELP with https
Message-Id: <92d1d7$q96@flatland.dimensional.com>
"Federico" <artax@shineline.it> writes:
> Please there is somebody who can help me with https protocol? I have to
> intorragate a search engine internal to a site. It's action/url starts with
> http but the response is an error: "501 (Not Implemented) Protocol scheme
> 'https' is not supported". So the question is: using LWP::UserAgent; how can
> i solve this problem???
See the README.SSL file in the libwww distribution.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
------------------------------
Date: 27 Dec 2000 10:23:44 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: How do I 'PREVENT' dos window popping up when "myscript.pl" executes? -TIA
Message-Id: <92cfvg$adb$1@nntp1.ba.best.com>
In article <5ZB16.976$iN1.147949@nnrp3.sbc.net>,
Santa <Santa@clause.sql> wrote:
>Activestates' Perl 5.06 build (620).
>I do not want a dos window popping up everytime someone hits my box and
>executes a perl script.
>How do I prevent this from happening?
Have you tried changing the first line of the perl script to
#!D:/perl/bin/wperl.exe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Wed, 27 Dec 2000 10:14:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How to delete items from an array?
Message-Id: <j2gj4to9ht438tolbc7ft2oks0g0ecsve4@4ax.com>
Uri Guttman wrote:
>well, since you always use map in a void context, here is a solution
>using map in a list context:
>
> my $i ;
> @array = map { $i++ % 2 ? $_ : () } @array ;
That's a grep.
my $i = 0; # avoid warning
@array = grep { $i++ % 2 } @array;
Er... does this fetch the correct selection?
my $i;
@array = grep { ++$i % 2 } @array;
There are some more farfetched solutions thinkable:
@array = @array[ grep { $_ % 2 == 0 } 0 .. $#array ];
--
Bart.
------------------------------
Date: Wed, 27 Dec 2000 10:17:22 GMT
From: georgebailey@my-deja.com
Subject: Re: How to delete items from an array?
Message-Id: <92cfjh$be$1@nnrp1.deja.com>
In article <slrn94j28h.1s2.abigail@tsathoggua.rlyeh.net>,
abigail@foad.org wrote:
> @array = @array [0, 2, 4, 6, 8 .. $#array];
>
> Or, if there are no undefined elements:
>
> delete @array [1, 3, 5, 7];
> @array = grep {defined} @array;
I'm a bit puzzled by this one -- I get a message that says you can
only use "delete" on hashes, not on regular arrays.
Anyway, this has taught me two useful things:
* it's easier if I start off with a list of what I want to keep, not what I
want to delete
* that use of grep which I didn't know about -- where is that
documented? I guess it means extract everything which *has* a
length, or everything where length(element) would return a true
value?
Thanks everyone.
~~ ...and dance by the light of the moon
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 27 Dec 2000 10:53:30 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: How to delete items from an array?
Message-Id: <slrn94jitn.ars.rgarciasuarez@rafael.kazibao.net>
georgebailey@my-deja.com wrote in comp.lang.perl.misc:
> > delete @array [1, 3, 5, 7];
>
> I'm a bit puzzled by this one -- I get a message that says you can
> only use "delete" on hashes, not on regular arrays.
Perl 5.6 allows to use delete() and exists() on arrays.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Wed, 27 Dec 2000 06:20:17 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to delete items from an array?
Message-Id: <slrn94jk3h.e1u.tadmc@magna.metronet.com>
georgebailey@my-deja.com <georgebailey@my-deja.com> wrote:
>In article <slrn94j28h.1s2.abigail@tsathoggua.rlyeh.net>,
> abigail@foad.org wrote:
>
>I'm a bit puzzled by this one -- I get a message that says you can
>only use "delete" on hashes, not on regular arrays.
You have an older perl.
> * that use of grep which I didn't know about -- where is that
>documented?
The same place that all of the other functions are documented,
perlfunc.pod.
perldoc -f grep
>I guess it means extract everything which *has* a
>length,
That wouldn't be too useful since it is *always* true :-)
>or everything where length(element) would return a true
>value?
grep() filters lists. If the EXPR is true, the element is selected
for the output list. The element is skipped if the EXPR is false.
So when length() returns a "true" (ie. when it has non-zero length),
the element is selected for the output list.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 27 Dec 2000 08:09:37 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to have three dimentional array
Message-Id: <slrn94jqgh.e1u.tadmc@magna.metronet.com>
shwekhaw@my-deja.com <shwekhaw@my-deja.com> wrote:
>I have having newbie trouble, I just testiong simple script from book
What book? What page?
>which is basically not working
>It is the script which search through a papragraph for a word and print
>out the location of that word under Line and Column.
>The problem is if there are two same words ,which are being searched ,
>in same line, it print out only last word as it overwrite the array
>content with same line.
>Let's see the code
^^^^^^^^^^^^
>#!/usr/local/bin/perl
If you want more people to see your code, then:
#!/usr/local/bin/perl -w
use strict;
It is rather silly to ask people to help find mistakes before
seeing if a machine can find them first.
Enabling warnings and strictures will find many common mistakes.
Take all the help you can get! Turn them on.
>chop ($word);
^^^^
Your book is about 5 *years* old then?
Or is it just one of the crappy Perl books? (there are *lots* of those)
Books that speak Perl 4 are suspect. I would not be depending
very heavily on such old advice, a lot has changed in the
5 years since Perl 4 was superceded.
Modern Perl programmers use chomp() to remove line endings.
> $finds{"$count"} = "$nextpos"; ##$count is line number but it
^ ^ ^ ^
If your book has those double quotes in it, then you can be
pretty sure that you got one of the crappy ones.
That code will work fine without any of the 4 double quote chars.
What book are you talking about?
>is overwrite when there is another word found.##
>I THINK I CAN SOLVE BY USING THREE DIMENTIONAL ARRAY.
Why are you shouting at us?
Since you think a multilevel data structure might help, you
have probably already read the standard Perl docs dealing with
multilevel data structures. Right?
perldoc perlreftut
perldoc perlref
perldoc perllol
perldoc perldsc
What part are you unclear on?
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 27 Dec 2000 15:05:58 GMT
From: Joseph <-nancy-@libero.it>
Subject: indexing web servers's content
Message-Id: <g81k4tcd13b9gqutreuvatgv4pdmbujg07@4ax.com>
Does anyone have a perl script that
allows to browse the content of another server ?
Joseph
------------------------------
Date: Wed, 27 Dec 2000 12:52:01 -0000
From: "Blair McGlashan" <blair@object-arts.com>
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE oflanguages??)
Message-Id: <92coer$6dq57$3@ID-50941.news.dfncis.de>
Dave
You wrote in message
news:SH_06.26911$A06.980822@news1.frmt1.sfba.home.com...
> ...
> I don't know what machine or Smalltalk dialect that was run on.
>
> But when I run it on 650MHz Athlon in QKS Smalltalk on the v4 AOS
Platform.
>
> "1000 factorial" takes 24ms (.024s).
On my rather slower laptop machine (a 333 Celeron) Dolphin 4.0 takes
just 13ms to execute 1000 factorial. This is one of the areas were Dolphin
is faster than most (if not all) other Smalltalks. I've always thought it
could be made a fair bit faster too with a bit of optimization.
> To try something that more fully tests multi-precision and GC performance
> try "10000 factorial", which on the same system takes 1257 ms (1.25s).
D4 takes 1371mS to do that on the same 333; still faster (bearing in mind
relative machine speed), but the other factors you mention (i.e. other than
LI arithmetic) are starting to come into play, evening out the difference.
I'm glad there is at least one area of VM design and performance where we at
least appear to be ahead of AOS Dave :-).
Regards
Blair
(Both figures are elapsed times measured using the microsecond
clock/profiling counter)
------------------------------
Date: Wed, 27 Dec 2000 10:42:43 GMT
From: ghorghor@my-deja.com
Subject: Open a big text file ( large than 200MB )
Message-Id: <92ch33$166$1@nnrp1.deja.com>
hi all
i have a pb with a big txt file large than 200MB,
i have a little station ( celeron 600 and 128Mb of ram on a linux
red hat 6.2 system )
i have wrote a little prog du read and do traitements on txt files.
With small files ( less than ram )
it's ok and quick
with a large file ( more than ram )
my hdd swap and it's slow
here is my code :
open(fic,"<toto.txt");
while(<fic>)
{
#read $_ and do traitement
}
close(fic);
the system load the file in ram
can i just load part of file in ram to increase speed ?
thx for helping
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 27 Dec 2000 14:27:26 +0000
From: nobull@mail.com
Subject: Re: Open a big text file ( large than 200MB )
Message-Id: <u9elyundm9.fsf@wcl-l.bham.ac.uk>
ghorghor@my-deja.com writes:
> here is my code :
Is this _really_ the code?
> open(fic,"<toto.txt");
> while(<fic>)
> {
> #read $_ and do traitement
> }
> close(fic);
>
> the system load the file in ram
No, it does not.
> can i just load part of file in ram to increase speed ?
You already do.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 27 Dec 2000 13:38:53 +0000
From: John Delacour <JD@Tallorno.net>
To: ghorghor@my-deja.com
Subject: Re: Open a big text file ( large than 200MB )
Message-Id: <v03130302b66fa15337ca@news>
At 10:42 am +0000 27/12/00, ghorghor@my-deja.com wrote:
>with a large file ( more than ram )
>my hdd swap and it's slow
>
>here is my code :
>open(fic,"<toto.txt");
>while(<fic>)
>{
> #read $_ and do traitement
>}
>close(fic);
>
>the system load the file in ram
>can i just load part of file in ram to increase speed ?
There are several ways to do this. One simple way is below, where you can
set $bytes to any number you want - 4096 seems to be a sort of convention
but 100000 or 1 will do. You can also look at sysread, Fcntl etc.
$bytes = 4096;
open FIN, "<$fin";
open FOUT, ">$fout";
while (read FIN, $_, $bytes) {
s/a/b/g;
print FOUT;
}
JD
JD
------------------------------
Date: Wed, 27 Dec 2000 08:17:44 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Open a big text file ( large than 200MB )
Message-Id: <slrn94jqvo.e1u.tadmc@magna.metronet.com>
ghorghor@my-deja.com <ghorghor@my-deja.com> wrote:
>i have a pb with a big txt file large than 200MB,
^^
How did Peanut Butter get into your file?
Please use real words instead of cutsie non-standard abbreviations.
>With small files ( less than ram )
>it's ok and quick
>with a large file ( more than ram )
>my hdd swap and it's slow
>
>here is my code :
>open(fic,"<toto.txt");
You should use UPPERCASE filehandles. Your Perl program will stop
working when you upgrade to a perl that has defined a fic() function.
You should always, yes *always*, check the return value from open():
open(FIC, 'toto.txt') || die "could not open 'toto.txt' $!";
>while(<fic>)
>{
> #read $_ and do traitement
>}
>close(fic);
>
>the system load the file in ram
No, that code does not load the file into memory.
There is only one line at a time in memory.
I expect the memory hogging part got snipped and replaced with
"#read $_ and do traitement" :-)
>can i just load part of file in ram to increase speed ?
I dunno, it depends on what you are trying to accomplish.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 27 Dec 2000 09:21:36 -0500
From: "Joel Ricker" <joejava@dragonat.net>
Subject: Our question - Possible Legacy code question...
Message-Id: <%Xm26.3086$Gc5.100761@news1.atl>
Is the our function a construct of perl higher than v5.004_04? That would
explain why I can't get it to work on my site. It's runs ok locally
(Activestate's new v5.6 buld) but not remotely (perl v5.004_04).
If this is the case and I can't convince my ISP to upgrade (doubtful), what
suggestions are there for redoing the template for creating modules found in
the Perl FAQ, located here:
http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfaq7/How_do_I_create_a_module
_.html and many other places. Can I just change our to my? Take off
strict? Or just turn it off temporarily?
Thanks
Joel
------------------------------
Date: Wed, 27 Dec 2000 23:08:28 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Parsing
Message-Id: <slrn94jmtr.8i7.mgjv@martien.heliotrope.home>
On 27 Dec 2000 00:29:13 -0600,
Andrew N. McGuire <anmcguire@ce.mediaone.net> wrote:
>>>>>> "TM" == Tad McClellan <tadmc@metronet.com> writes:
>
>TM> mountain_arts <mountain_arts> wrote:
>>> abigail@foad.org (Abigail) wrote:
>>>
>>>> Simon Stiefel (SiStie@nuclear-network.de) wrote on MMDCLXXIII September
>>>> MCMXCIII in <URL:news:Pine.LNX.4.31.0012252154170.3664-100000@server.stiefel.priv>:
>>>> // I want to parse the output of "finger".
>>>> // The output could be something like this:
>>>> //
>>>> // sistie Simon Stiefel *3 - Mon 20:12
>>>> // ^^^^^^^^^^|^^^^^^^^^^^^^^^^^^^^|^^^^^^^^^^^^|^^^^^|^^^^^^^^^^
>>>> // $1 $2 $3 $4 $5
>
>>>> unpack
>
>>> why not split?
>
>TM> split() is for data with separators, finger(1)'s data does not
>TM> have separators.
>
>TM> unpack() is for fixed-width fields, finger(1)'s data is
>TM> fixed-width fields.
>
> would it not be faster still to use substr(), i dont think that
> finger will produce huge amounts of output (on most systems).
I don't believe it would be faster, but I wouldn't swear on that without
a benchmark. I'd bet on it though. However, apart from speed, unpack
does all kinds of nice things for you, like getting rid of trailing
spaces:
# cat foo.pl
#!/usr/local/bin/perl -wnl
@foo = unpack "A10 A21 A9 A6 A13", $_;
print join ':', @foo;
# finger | ./foo.pl
Login:Name:Tty:Idle:Login Time
maggie:Margaret Morgan:pts/7::Dec 24 22:58
mgjv:Martien Verbruggen:pts/0: 2d:Dec 10 23:10
mgjv:Martien Verbruggen:pts/1: 10d:Dec 10 23:12
[SNIP]
Note that leading spaces are left alone.
substr doesn't get rid of spaces for you. substr also doesn't allow you
to assign to a list in one go, so you end up doing multiple calls, which
is hard to maintain, and most likely a lot slower as well (but a
benchmark would need to prove that):
# cat foo.pl
#!/usr/local/bin/perl -wnl
my @foo;
push @foo, substr $_, 0, 10;
push @foo, substr $_, 10, 21;
push @foo, substr $_, 31, 9;
push @foo, substr $_, 40, 6;
push @foo, substr $_, 46, 13;
print join ':', @foo;
# finger | ./foo.pl
Login :Name :Tty :Idle :Login Time
maggie :Margaret Morgan :pts/7 : 4 :Dec 24 22:58
mgjv :Martien Verbruggen :pts/0 : 2d :Dec 10 23:10
mgjv :Martien Verbruggen :pts/1 : 10d :Dec 10 23:12
[SNIP]
So you need more code, more calls to Perl internals, and more work to
get rid of spaces that you probably don't want. I'd say it's probably
slower. I'm too lazy to benchmark it, and too convinced that unpack is
going to win hands down :)
Now, imagine that you need to run this code on a system where the first
field is one character wider. Would you rather change the unpack
template, or the list of substr calls?
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia |
------------------------------
Date: Wed, 27 Dec 2000 15:59:31 +0100
From: Simon Stiefel <SiStie@nuclear-network.de>
Subject: Re: Parsing
Message-Id: <Pine.LNX.4.31.0012271559120.2033-100000@server.stiefel.priv>
On Mon, 25 Dec 2000, Garry Williams wrote:
Hi there,
> On Mon, 25 Dec 2000 22:23:54 +0100, Simon Stiefel wrote:
> >I want to parse the output of "finger".
> >The output could be something like this:
> >
> >root root 1 1 Mon 20:10
> >root root 2 - Mon 20:10
> >sistie Simon Stiefel *3 - Mon 20:12
> >^^^^^^^^^^|^^^^^^^^^^^^^^^^^^^^|^^^^^^^^^^^^|^^^^^|^^^^^^^^^^
> > $1=09=09 $2=09=09 $3=09 $4 $5
>
> How about using unpack()? Or substr()?
>
> (See the perlfaq5 manual page, "How can I manipulate
> fixed-record-length files?" for an example.)
Thank you. I tried it, but it wouldn't work like I want to.
So, can someone give me (Perl-Newbie) a complete solution for this
problem? That would be really kind. :-)
Background:
I am programming a little script for our Linux-server and with this
script you can see the details of logged-in users (-> finger).
> By the way, those variables above are read-only. You probably want to
> choose different names.
Yes, I'll do that.
> >And, excuse me about my terrible english...
>
> It's excellent! (Well, it's much better than my German :-)
Really? Cool... ;-)
> Garry Williams
Mit freundlichen Gr=FC=DFen, .~. Open Minds.
with best regards /V\ Open Sources.
// \\ Open Future!
Simon Stiefel /( )\_ I N U X
^ ~ ^
--=20
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@nuclear-network.de | http://www.nuclear-network.de |
|ICQ#: 20196644 | phone: +49(0)7123/379070 | fax: +49(0)179/335990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |
------------------------------
Date: 27 Dec 2000 15:13:40 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Parsing
Message-Id: <92d0v4$954$1@bob.news.rcn.net>
Simon Stiefel <SiStie@nuclear-network.de> wrote:
> On Mon, 25 Dec 2000, Garry Williams wrote:
>> How about using unpack()? Or substr()?
>>
>> (See the perlfaq5 manual page, "How can I manipulate
>> fixed-record-length files?" for an example.)
> Thank you. I tried it, but it wouldn't work like I want to.
> So, can someone give me (Perl-Newbie) a complete solution for this
> problem? That would be really kind. :-)
How about showing us the code you came up with and telling us exactly what
it does wrong?
------------------------------
Date: Thu, 28 Dec 2000 00:53:38 +1100
From: "Chris" <CHRISVAL@bigpond.com.au>
Subject: perl on win 98
Message-Id: <Llm26.166100$e5.143278@newsfeeds.bigpond.com>
Hi everyone my name is Chris,
I just installed PERL ACTIVE STATE on my win 98 machine,
although I can run a PERL SCRIPT by entering the command
[perl script_name] from the dos prompt, what I would like to
know is with this interpreter can I use it in the same way as if
I was passing DATA from a HTML form page as if I was on-line
and if so how is it configured to do so.
Also are the path's in the HTML PAGE or the PERL SCRIPT PAGE
used in the same way as unix syntax [eg] system # ! /usr/(ETC) with
forward slashesor do the paths represent the local DOS path's
# ! \c:\windows\(ETC) using backslashes.
The Reason:
Like I said, I can run perl scripts within dos to test them but I have not
been able to run them or call them from my HTML page while off-line.
What happens is when I try to call the script from my web page it just
displays
the code in my script as a text file and prints that to the HTML page
not the result of the code.
If this is posible I believe I can get up to speed alot quicker than playing
the
uploading and downloading game with my ISP.
Any help is greatly appreciated
Chris Val
------------------------------
Date: Wed, 27 Dec 2000 07:33:50 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: perl on win 98
Message-Id: <dan26.17786$wE3.25978@newsfeed.slurp.net>
Chris <CHRISVAL@bigpond.com.au> wrote in message
news:Llm26.166100$e5.143278@newsfeeds.bigpond.com...
> Hi everyone my name is Chris,
>
> I just installed PERL ACTIVE STATE on my win 98 machine,
> although I can run a PERL SCRIPT by entering the command
> [perl script_name] from the dos prompt, what I would like to
> know is with this interpreter can I use it in the same way as if
> I was passing DATA from a HTML form page as if I was on-line
> and if so how is it configured to do so.
do you have a server on your local machine? try a search for OmniHTTPd.
I've only got a 404 link for it.
------------------------------
Date: Wed, 27 Dec 2000 14:35:35 GMT
From: schnurmann@my-deja.com
Subject: Re: perl on win 98
Message-Id: <92cunn$a3n$1@nnrp1.deja.com>
Leave the path as #! /usr/bin/perl and it should work fine, even on
Windoze 98.
In article <Llm26.166100$e5.143278@newsfeeds.bigpond.com>,
"Chris" <CHRISVAL@bigpond.com.au> wrote:
> Hi everyone my name is Chris,
>
> I just installed PERL ACTIVE STATE on my win 98 machine,
> although I can run a PERL SCRIPT by entering the command
> [perl script_name] from the dos prompt, what I would like to
> know is with this interpreter can I use it in the same way as if
> I was passing DATA from a HTML form page as if I was on-line
> and if so how is it configured to do so.
> Also are the path's in the HTML PAGE or the PERL SCRIPT PAGE
> used in the same way as unix syntax [eg] system # ! /usr/(ETC) with
> forward slashesor do the paths represent the local DOS path's
> # ! \c:\windows\(ETC) using backslashes.
>
> The Reason:
> Like I said, I can run perl scripts within dos to test them but I
have not
> been able to run them or call them from my HTML page while off-line.
> What happens is when I try to call the script from my web page it just
> displays
> the code in my script as a text file and prints that to the HTML page
> not the result of the code.
>
> If this is posible I believe I can get up to speed alot quicker than
playing
> the
> uploading and downloading game with my ISP.
>
> Any help is greatly appreciated
>
> Chris Val
>
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 27 Dec 2000 15:00:30 GMT
From: cyner.mail@sweden.com (chr1st1an)
Subject: Re: perl on win 98
Message-Id: <iun26.1430$wz.74187@nntp1.chello.se>
---| "Chris" <CHRISVAL@bigpond.com.au> wrote: |---
> I just installed PERL ACTIVE STATE
> /.../ can I use it in the same way as if
> I was passing DATA from a HTML form page as if I was on-line
> and if so how is it configured to do so.
Only if you are running a local web server. Try Microsofts Personal Web
Server.
> Also are the path's in the HTML PAGE or the PERL SCRIPT PAGE
> used in the same way as unix syntax [eg] system # ! /usr/(ETC) with
> forward slashesor do the paths represent the local DOS path's
> # ! \c:\windows\(ETC) using backslashes.
I think you use "#!C:\Windows\(ETC)" without the quotes.
> ... I have not
> been able to run them or call them from my HTML page while off-line.
> What happens is when I try to call the script from my web page it just
> displays
> the code in my script as a text file and prints that to the HTML page
> not the result of the code.
Then you don't have a web server installed.
|
| chr1st1an
| cyner.mail@sweden.com
|
------------------------------
Date: Thu, 28 Dec 2000 02:20:50 +1100
From: "Chris" <CHRISVAL@bigpond.com.au>
Subject: Re: perl on win 98
Message-Id: <vDn26.166125$e5.143472@newsfeeds.bigpond.com>
Thanks everybody, I checked and I dont have
the web server installed (how stupid was that)
anyway I will install it and give it another go.
Thanks for the replies
Chris
"chr1st1an" <cyner.mail@sweden.com> wrote in message
news:iun26.1430$wz.74187@nntp1.chello.se...
> ---| "Chris" <CHRISVAL@bigpond.com.au> wrote: |---
>
> > I just installed PERL ACTIVE STATE
> > /.../ can I use it in the same way as if
> > I was passing DATA from a HTML form page as if I was on-line
> > and if so how is it configured to do so.
>
> Only if you are running a local web server. Try Microsofts Personal Web
> Server.
>
> > Also are the path's in the HTML PAGE or the PERL SCRIPT PAGE
> > used in the same way as unix syntax [eg] system # ! /usr/(ETC) with
> > forward slashesor do the paths represent the local DOS path's
> > # ! \c:\windows\(ETC) using backslashes.
>
> I think you use "#!C:\Windows\(ETC)" without the quotes.
>
> > ... I have not
> > been able to run them or call them from my HTML page while off-line.
> > What happens is when I try to call the script from my web page it just
> > displays
> > the code in my script as a text file and prints that to the HTML page
> > not the result of the code.
>
> Then you don't have a web server installed.
>
> |
> | chr1st1an
> | cyner.mail@sweden.com
> |
------------------------------
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 V9 Issue 5205
**************************************