[18275] in Perl-Users-Digest
Perl-Users Digest, Issue: 443 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 8 09:05:43 2001
Date: Thu, 8 Mar 2001 06:05:14 -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: <984060313-v10-i443@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 8 Mar 2001 Volume: 10 Number: 443
Today's topics:
Re: [newbie] How to take parameters into the script? (Bernard El-Hagin)
Re: alarm() syntax (Anno Siegel)
Re: ASP in Perl (EED)
Re: ASP in Perl <hernux@etherac.com.ar>
Can it be done? <tomas@place1.com>
Re: DeCSS in Perl (EED)
Re: DeCSS in Perl (Rafael Garcia-Suarez)
Emergency! Can't use LWP::Simple! emelin@my-deja.com
Re: Grokking map and grep <pne-news-20010308@newton.digitalspace.net>
Re: Grokking map and grep <pne-news-20010308@newton.digitalspace.net>
Re: Grokking map and grep (Philip Lees)
Re: Help to Install Perl <dream1625@aol.com>
Re: Help to Install Perl (Anno Siegel)
Re: if($array1[1] eq $string1) DOESN'T WORK?? (Anno Siegel)
Is there anybody family with MRTG(Multi Router Tracffic <zhengwu@noya.bupt.edu.cn>
Re: Newbie: How do I substitute a range of lines in a <Jerome.Abela@free.fr>
Re: perl editors (Carsten Saathoff)
Re: print abstract ('blah'); # subroutine or file handl (EED)
Re: Question on sockets <peter.s@tjgroup.dk>
Re: Reading a file <iqbals8@cs.man.ac.uk>
Re: removing text from log files (Bernard El-Hagin)
Re: Replacing list item dcutter@gmx.de
Re: Small perl sort question (Abigail)
Re: Use PERL or Java? Which is faster? (Harri Haataja)
Re: Use PERL or Java? Which is faster? (Harri Haataja)
Re: Use PERL or Java? Which is faster? <thunderbear@bigfoot.com>
Re: Use PERL or Java? Which is faster? <noselasd@frisurf.no>
Re: Use PERL or Java? Which is faster? (Harri Haataja)
Re: What information can I get from a GLOB reference? <Jerome.Abela@free.fr>
Re: word boundary example dcutter@gmx.de
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 8 Mar 2001 08:56:42 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: [newbie] How to take parameters into the script?
Message-Id: <slrn9aei5t.epa.bernard.el-hagin@gdndev32.lido-tech>
[Fixed stupid Jeopardy quoting]
On Wed, 07 Mar 2001 17:16:05 -0500, Shane McDaniel <shanem@ll.mit.edu>
wrote:
>Andy wrote:
>>
>> Hi,
>>
>> say I have a script that will translate a morse code into an acsii code.
>> This script called "m2s" and i want this m2s to take 2 parameter at the
>> command when the script is activated. where parameter 1 is a file in mosrse
>> code, parameter 2 is the name of the file that the translated code is
>> stored. It looks like:
>> % m2s parameter1 parameter2
>>
>> in case of both parameters are missing, the script will output a usage info.
>> If only one parameters, the script will assume its the file to read and
>> output the result (translated ascii code) to the screen.
>>
>> Any help is greatly appreciated!
>
> Instead of answering your question I think it would be best if you went
>and read the subroutines section of a perl book. Nothing personal, but
>the fact that you don't know this shows you haven't read enough.
Wouldn't it be easier if the guy read about the special array @ARGV?
Nothing personal, but the fact you don't know this shows you haven't
read enough.
> I can't stress how important it is to _know_ perl and not just how to
>hack together scripts. It'll save you in the end.
I can't stress how important it is to _know_ what the hell you're
talking about before getting all high and mighty with a beginner. It'll
save you in the end.
Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'
------------------------------
Date: 8 Mar 2001 12:01:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: alarm() syntax
Message-Id: <987sa7$mgd$1@mamenchi.zrz.TU-Berlin.DE>
According to Walter Greenwood <ritter@sonic.net.invalid>:
>
> I am new to perl and am having difficulty adding an alarm to this....
I'd just like to point out that your problem is not the syntax of
the alarm call. The syntax is the same for every single-argument
operator in Perl, and it's utterly simple.
Anno
------------------------------
Date: Thu, 08 Mar 2001 12:45:42 +0100
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: Re: ASP in Perl
Message-Id: <3AA770E6.B8131799@eed.ericsson.se>
Hernux wrote:
>
> Is there a way to simulate an ASP Session Object in Perl....
Do you mean Apache::Session?
------------------------------
Date: Thu, 8 Mar 2001 09:54:32 -0300
From: "Hernux" <hernux@etherac.com.ar>
Subject: Re: ASP in Perl
Message-Id: <987vji$sl8$1@taliesin.netcom.net.uk>
I mean Session vars,
like
if (!Session("loginOK")){
&CheckLogin;
}
"Hernux" <hernux@etherac.com.ar> escribió en el mensaje
news:986lm4$38k$1@taliesin.netcom.net.uk...
> Is there a way to simulate an ASP Session Object in Perl....
>
>
> Thanx
>
>
------------------------------
Date: Thu, 08 Mar 2001 12:14:58 GMT
From: Tomas <tomas@place1.com>
Subject: Can it be done?
Message-Id: <MPG.1511963d66e8135f98969e@news1.telia.com>
Hi Guys,
Is there any pre written scripts or applications out there who can
handle the following tasks. (The same way as wget can handle it, except
that wget not seems to be able to handle https:// request).
1. Remotely login to a secure web site https://www.domain.com/ using
assigned user name and password.
2. Switch to different specified pages and download the complete HTML
page.
Any help would be very appreciated.
Best, Tomas
------------------------------
Date: Thu, 08 Mar 2001 12:34:19 +0100
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: Re: DeCSS in Perl
Message-Id: <3AA76E3B.D6B514BE@eed.ericsson.se>
Malte Ubl wrote:
> some of you might find this interesting. It's an article about
> a 7 line implementation of the DeCSS algorithm to decipher DVDs
> in Perl:
>
> http://www.wired.com/news/culture/0,1284,42259,00.html
Why do they write:
while(read+STDIN,$_,2048)
What is the meaning of + here?
------------------------------
Date: Thu, 08 Mar 2001 11:40:46 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: DeCSS in Perl
Message-Id: <slrn9aerti.pq.rgarciasuarez@rafael.kazibao.net>
Alexander Farber wrote in comp.lang.perl.misc:
>
> Why do they write:
>
> while(read+STDIN,$_,2048)
>
> What is the meaning of + here?
Obfuscation. This avoids to use a space. (this is the unary + operator)
$ echo 'while(read+STDIN,$_,2048){}' | perl -MO=Deparse
while (read STDIN, $_, 2048) {
();
}
- syntax OK
$ echo 'while(read STDIN,$_,2048){}' | perl -MO=Deparse
while (read STDIN, $_, 2048) {
();
}
- syntax OK
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 8 Mar 2001 12:55:14 GMT
From: emelin@my-deja.com
Subject: Emergency! Can't use LWP::Simple!
Message-Id: <987vfi$lg2$1@news.netmar.com>
I recently had to switch webservers, and now I'm stuck with one that doesn't
support LWP::Simple! I noticed that my cgi scripts using this module wouldn't
work, and after being in contact with the server admin, I found out that the
module wasn't installed!
Does anyone know another way to do what LWP::Simple getstore() and get() do?!?
Can I get around this problem?
And what do you think about a server that doesn't support LWP::Simple?! I've
tried a couple of other ones before and never had any problems!
thankful for help,
emelin
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: Thu, 08 Mar 2001 13:21:44 +0100
From: Philip Newton <pne-news-20010308@newton.digitalspace.net>
Subject: Re: Grokking map and grep
Message-Id: <74ueato5msunfvva7eberms7j8camqhj9p@4ax.com>
On Wed, 07 Mar 2001 11:07:55 GMT, pjlees@ics.forthcomingevents.gr
(Philip Lees) wrote:
> On Tue, 06 Mar 2001 12:48:12 +0100, Philip Newton
> <pne-news-20010306@newton.digitalspace.net> wrote:
>
> >my @lines = map { $_->[1] }
> > sort { $a->[0] <=> $b->[0] }
> > map { [ (split /,/, $_, 2)[0], $_ ] }
> > grep { /^\d+,/ }
> > <IN>;
>
> Using the third argument for split is a good idea, since I'm only
> interested in the first fields anyway, and the [0] following the split
> just returns a list of those first fields, right?
Sort of; it returns the first field (singular) of each line. The map
bit makes a list out of all those first fields.
> In the sort, $a->[0] is the same as $$a[0], as far as I understand.
Yes. I prefer the arrow notation as it's clearer to me, but
B::Deparse, for example, would produce the $$ notation.
> >> 2. Is there any trick for getting the scalar result of the leftmost
> >> map _as well as_ the list ouput, so that I could get rid of that
> >> annoying $count variable?
> >
> >Well, the scalar result of map is the number of elements generated --
> >so assigning to an array and using that array in scalar context will
> >give you the answer. I can't think of how to do it without the
> >intermediate array variable, however.[1]
>
> I was afraid of that. What I was hoping for was some environment
> variable that counts the elements in a map. I couldn't find one in
> perlvar, but I suppose that Perl must 'know' how many elements map has
> processed.
I think you want "global variable" or "special variable" instead of
"environment variable" -- Perl doesn't put anything into the
environment (i.e., %ENV) unless you ask it to AFAIK.
I suppose it boils down to the fact that you can run map in scalar
context or in list context, but not both simultaneously.
> Thanks for the help, Philip.
Happy to help.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Thu, 08 Mar 2001 13:26:59 +0100
From: Philip Newton <pne-news-20010308@newton.digitalspace.net>
Subject: Re: Grokking map and grep
Message-Id: <mbueat0chli8uop2sbv3cdcp4b6331h2t4@4ax.com>
On Wed, 07 Mar 2001 11:19:25 GMT, pjlees@ics.forthcomingevents.gr
(Philip Lees) wrote:
> No, not a good deal, I agree. I was afraid I couldn't have it both
> ways. What I was hoping for was some environment variable that counts
> the elements in the last map. I couldn't find one in perlvar, but I
> suppose that Perl must 'know' how many elements map has processed and
> I wondered if there was some way to access that, while still keeping
> the list output of map.
Not necessarily. Perl knows what context each operator is invoked
from, and if map is in scalar context, it can keep count; if it's
invoked in list context, it remembers the outputs. I don't think it
keeps count of the number of elements if you use map in list context,
so you'd have to count them yourself.
(For example, by assigning the output of map to an array variable...
but then you have the extra variable you wanted to avoid.)
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Thu, 08 Mar 2001 13:10:53 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Grokking map and grep
Message-Id: <3aa78464.81987121@news.grnet.gr>
On 07 Mar 2001 07:59:07 -0800, merlyn@stonehenge.com (Randal L.
Schwartz) wrote:
>>>>>> "Philip" == Philip Lees <pjlees@ics.forthcomingevents.gr> writes:
>
>Philip> .. and of course, when I go back to the docs, I now find that I
>Philip> understand the Schwartzian Transform example there, too.
>
>Good, then can someone explain it to me?
>
Yes, well. The superficial differences in notation and formatting
between my own code and the FAQ example somehow blinded me to the fact
that I was reinventing the Schwartzian Transform, or something very
like it.
Never mind - it was a valuable learning experience. Onwards and
upwards.
Phil
--
@x=split//,'Just another Perl decoder,';split//,'*'x@x;%i=split/=/,
'AA=a=aa= =1=,';for$i(0..$#x){$_[$i]=chr($=+5);while($_[$i]ne$x[$i])
{$_[$i]=$i{$_[$i]}if$i{++$_[$i]};print@_,"\r";while(rand!=rand){}}}
Ignore coming events if you wish to send me e-mail
------------------------------
Date: Thu, 08 Mar 2001 11:55:39 GMT
From: "Suzanne" <dream1625@aol.com>
Subject: Re: Help to Install Perl
Message-Id: <%qKp6.161592$B6.36271990@news1.rdc1.md.home.com>
Here's a ploink back at ya ... Thanks to some helpful advice from these
newsgroups, I now have Perl installed and running as well. Thanks to those
who led me to the right place to get that accomplished. As for "top
posting" ... not familiar with any particular etiquette ... if that means
that you type where your cursor goes automatically in my news reader instead
of scrolling through material already read, whooooops ... guess I'm guilty.
As far as your remark about being rude to nobull .... nobull was rude to me
first and I responded back, as is my fashion when those who think they
patrol and control the Internet in some way respond with their nasty little
messages. That being said, again ... thanks to those who responded back
with helpful info.
__________________________________________
Suzanne @CampusTech
http://www.campustech.com Beta Site: http://campust.iserver.net/
Big Discounts on Software for Students & Teachers
Chris Stith <mischief@velma.motion.net> wrote in message
news:tadf5nbdm83v59@corp.supernews.com...
> Suzanne <suzanne@campustech.com> wrote:
> > The last time I checked, I paid my bills for Internet service, and I
lived
> > in a free country .... and I can ask questions and get answers in
newsgroups
> > like any other red-blooded American .... and you are not the boss of the
> > Internet, unless someone promoted you and didn't tell me ...
UNDERSTAND!?
>
> Manners, traditions, and cust have little to do with employment status.
> Spamming is rude. Top-posting is rude. Your response to nobull, who is
> a valued regular poster here, is rude. You are apparently a rude person.
>
> I can deal with an occaisional bit of rudeness. The regulars here can
> vouch that there are people who post here who are a little bit rude
> now and again, but whom many of us still deal with mostly politlely,
> because they have redeeming posts as well. I see no posts from you
> which redeem all the rude things you have done.
>
> I've never killfiled anyone in all the 8 years I've been using Usenet
> newsgroups. Hopefully you can take pride in being the first.
>
> *plonk*
>
> Chris
>
> --
> Christopher E. Stith
> Disclaimer: Actual product may not resemble picture in ad in any way.
>
------------------------------
Date: 8 Mar 2001 13:35:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help to Install Perl
Message-Id: <9881ru$qka$1@mamenchi.zrz.TU-Berlin.DE>
According to Suzanne <sbucciarelli1@home.com>:
> Here's a ploink back at ya ... Thanks to some helpful advice from these
> newsgroups, I now have Perl installed and running as well....
You also made sure you'll have a hard time if you ever want advice from
this group again.
Anno
------------------------------
Date: 8 Mar 2001 13:55:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: if($array1[1] eq $string1) DOESN'T WORK??
Message-Id: <988317$qka$2@mamenchi.zrz.TU-Berlin.DE>
According to Uri Guttman <uri@sysarch.com>:
> over c that we all should hank larry for. no more dangling statements
^^^^
Hmm... Two corrections come to mind.
Anno
------------------------------
Date: Thu, 8 Mar 2001 16:07:01 +0800
From: "zw" <zhengwu@noya.bupt.edu.cn>
Subject: Is there anybody family with MRTG(Multi Router Tracffic Grapher) software?
Message-Id: <987ev1$5gh5@gus.buptnet.edu.cn>
I have been used MRTG software in my Unix box,and now I have to modify the
source code.
MRTG fetch MIB info directly from net devices,now I have another C program
which can get MIB info and store them in Oracle database,so I have to make
MRTG to fetch MIB info from database instead of net devices.
------------------------------
Date: Thu, 08 Mar 2001 10:30:19 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: Newbie: How do I substitute a range of lines in a doc?
Message-Id: <3AA75E1C.E789E927@free.fr>
JM Wood wrote:
> I'd like to substitute (to update) old with new information in a document
> over a range of lines, between a specific START and END pattern.
perl -pi -e 's/old/new/g if(/START/../END/)' filename
Jerome.
--
()
/\
------------------------------
Date: 8 Mar 2001 08:37:34 GMT
From: kodemaniak@gmx.de (Carsten Saathoff)
Subject: Re: perl editors
Message-Id: <slrn9aeheh.k3.kodemaniak@kodemaniak.matrix>
hanja <hanja@my-deja.com> wrote:
> Out of curiousity, what editor do you use to write your scripts?
>
> -hanja
>
>
> Sent via Deja.com
> http://www.deja.com/
nedit
www.nedit.org
--
Carsten Saathoff <kodemaniak@gmx.de>
ICQ #52558095
...powered by Linux
------------------------------
Date: Thu, 08 Mar 2001 12:48:51 +0100
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: Re: print abstract ('blah'); # subroutine or file handle?
Message-Id: <3AA771A3.F4EFE866@eed.ericsson.se>
Tad McClellan wrote:
> Alexander Farber (EED) <eedalf@eed.ericsson.se> wrote:
> >
> > print abstract ('blah');
>
> The problem occurs because at this point in the parsing, perl
> does not know of any subroutine named 'abstract'. If it did
> know that you would be defining such a subroutine, then it
> would do the Right Thing.
But I also haven't opened any file handle called
"abstract". So the perl-parser is not consistent here.
------------------------------
Date: Thu, 8 Mar 2001 13:46:13 +0100
From: "Peter Søgaard" <peter.s@tjgroup.dk>
Subject: Re: Question on sockets
Message-Id: <987unm$d8p$1@news.inet.tele.dk>
Well, the easy way to get rid of the error message is to turn perl warnings
off...( the -w in the she-bang line )
If you want to keep perlwarnings on you could alter your line 13, avoiding
the comparison with undef:
if (!open_TCP(F, $ARGV[0], 80)) {
..or you could simply handle the errors with die, i.e:
open_TCP(F,$ARGV[0],80) or die "Usage: $0 Ipaddress\n\nReturns the HTTP
result code from a web server.\n\n";
/Peter
"Copenhagen" <hafateltec@hotmail.com> skrev i en meddelelse
news:Iazp6.2639$Cd.53477598@news.randori.com...
> This little script is giving me a headache. It returns what I expect it
to
> except I am getting an error " Use of uninitialized value at soctest1.pl
> line 13 "
> My argument is 192.168.1.10 which is the webserver. Where is my
> 'uninitialized value' comming from? "F" ? That is my filehandle for the
> socket? I am bedazzaled.
>
> #!/usr/bin/perl -w
>
> use Socket;
>
> # If no parameters were given, print out help text
> if ($#ARGV) {
> print "Usage: $0 Ipaddress\n";
> print "\n Returns the HTTP result code from a web server.\n\n";
> exit(-1);
> }
>
> # contact the server
> if (open_TCP(F, $ARGV[0], 80) == undef) {
> print "Error connecting to server at $ARGV[0]\n";
> exit(-1);
> }
>
> # send the GET method with / as a parameter
> print F "GET / HTTP/1.0\n\n";
>
> # get the response
> $return_line=<F>;
>
> # print out the response
> print "The server had a response line of: $return_line";
> close(F);
>
>
> sub open_TCP
> {
> # get parameters
> my ($FS, $dest, $port) = @_;
>
> my $proto = getprotobyname('tcp');
> socket($FS, PF_INET, SOCK_STREAM, $proto);
> my $sin = sockaddr_in($port,inet_aton($dest));
> connect($FS,$sin) || return undef;
>
> my $old_fh = select($FS);
> $| = 1; # don't buffer output
> select($old_fh);
> 1;
> }
>
> --
> ##############Þ
> print "\n Welcome to NEPP";$Þ=1;while ($Þ){
> print "\n$Þ";$Þ++;if ($Þ == 1000) {
> print "\n$Þ"."\nWell almost never ending :þ";exit;}}
> ##############Þ
>
>
------------------------------
Date: Thu, 08 Mar 2001 12:09:35 +0000
From: Shazad Iqbal <iqbals8@cs.man.ac.uk>
Subject: Re: Reading a file
Message-Id: <3AA7767F.E884F205@cs.man.ac.uk>
I took your advise and it was brilliant, i m just a beginner in this
field, and the Unix lab doesnt run at one it meant something else :-)
Much apprecieted for your help
Shazad iqbal
nobull@mail.com wrote:
>
> Shazad Iqbal <iqbals8@cs.man.ac.uk> writes:
>
> > Subject: Reading a file
>
> Question has nothing to do with reading files. (It had to do with
> _parsing_ which is something altogether different).
>
> > I am trying to extract all the vital details from a file usinf regular
> > expressions. I cant seem to get the hang of the matching clauses.
>
> You are forgetting that the * qualifier is by default greedy.
>
> You are forgetting that the ? qualifier exists.
>
> You are probably being too stict in your regex - if you assume your
> data is going to conform to the correct format you dont need to spell
> it out - e.g. say (\d+) rather than (\d{2}) if there's no chance that
> the next character is going to be a digit.
>
> You also appear to be trying to solve a problem without specifying it first.
>
> You must first be able to describe the syntax of your data
> unabiguously before you try to write a program to parse it.
>
> Although your file format _may_ be parseable by a single m// operator
> this may not be the best approach if you are optomising for maintainabiliy.
>
> You also seem to use pattern match to test string equality - one of
> the cardinal Perl sins.
>
> > #!/opt/perl/bin/perl -w
> > use strict;
>
> Very good.
>
> > my (
> > $PRINCIPLE_GROUP,
> > $EXAMPLE_CLASSES_OR_LAB,
> > $USERNAME,
> > $MODULES,
> > @PRINCIPLE_GROUP,
> > @EXAMPLE_CLASSES_OR_LAB,
> > @USERNAME,
> > @MODULES,
> > $index );
>
> If you feel the need to declare a lot of variables in one place this
> is should be taken as a warning sign. Rather than using a lot of
> paralell arrays I think a hash of hashes would be the more natual structure.
>
> > # Group/ Example Clases
> > Username Modules
> > # Y/1112E=Th15a,1412=W,1412E=Th15b,MT1662E=Mo16,Unix12=S1 akrami0 1011
> > 1021 1031 1041 1052 1062 1072 1112 1211 1311 1412 MT1662
> > # ABIS brodiejx 1511 1522 1532
> > # W/1112E=Tu10a,Unix12=S1 brownea0 1011 1021 1031 1041 1052 1062 1072
> > 1112 1211 1222 1311 MT1672
>
> I really can't understand that - I thought I'd got it but I can't
> believe you run Unix example classes at 1am on Saturday...
>
> OK lets take it nice and easy rather than running at it headlong.
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my %user_info;
>
> sub some_function_of ($) {
> # I can't guess the syntax of the class list
> @_;
> }
>
> while (<DATA>) {
> chomp;
> my ($group,$user,@modules) = split /\s+/;
> next unless defined $user;
>
> my @classes;
> if ( $group =~ s/\/(.*)// ) {
> @classes = some_function_of($1);
> }
>
> $user_info{$user} = {
> Group => $group,
> Classes => \@classes,
> Modules => \@modules,
> };
> }
> close DATA;
>
> print "what is your username ?\n\n";
> my $user = <STDIN>;
> chomp $user;
>
> print "Your username is $user\n";
>
> if ( my $u = $user_info{$user} ) {
> print " the module he/she does are @{$u->{Modules}}, in group $u->{Group}.\n";
> } else {
> print "You have not typed in an incorrect username\n";
> }
>
> __DATA__
> Y/1112E=Th15a,1412=W,1412E=Th15b,MT1662E=Mo16,Unix12=S1 akrami0 1011 1021 1031 1041 1052 1062 1072 1112 1211 1311 1412 MT1662
> ABIS brodiejx 1511 1522 1532
> W/1112E=Tu10a,Unix12=S1 brownea0 1011 1021 1031 1041 1052 1062 1072 1112 1211 1222 1311 MT1672
> __END__
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Thu, 8 Mar 2001 08:50:45 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: removing text from log files
Message-Id: <slrn9aehqo.epa.bernard.el-hagin@gdndev32.lido-tech>
On Wed, 7 Mar 2001 16:41:23 -0700, Michael Mishler
<mike@nospam.mishlercomputers.com> wrote:
>Basically a newbie here, and was just wondering how to remove text from a
>log file.
>
>For example: I can make a perl script write to a log file and append
>message to that log file, but what commands are available in perl to remove
>text?
>
>Please explain or point me in the right direction.
Read about the -i switch in perldoc perlrun.
Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'
------------------------------
Date: 8 Mar 2001 09:44:40 GMT
From: dcutter@gmx.de
Subject: Re: Replacing list item
Message-Id: <987ka8$bsg$1@news.netmar.com>
In article <3AA68CA9.C0C3B5B6@zdnetonebox.com>, nis <nissj@zdnetonebox.com>
writes:
>Hi all,
>
>I have a lists for example
> @ORG = (1.R 2.R 5.K 6.L 7.L 15.K 16.K 17.K 18.K)
>
>I also have 2 numbers for example 1-20.
>
>Now I want to run throuh each number (1-20) and add ".K" (or some other
>letter) to the number in turn.
>If there is a match in the ORG-list it should replace that one with the
>new number.value.
Godzilla is right, @ORG is an array of strings. you should write
@ORG = qw( ... );
but you would, for a faster search, be better off with a hash
%ORG = {'1.R' -> 0, '2.R' -> 0, ... };
now all you need is one loop
for ($i=1; $i<=20; $i++) {
if (exists($ORG{$i . 'K'}) {
# body action
}
}
Daniel
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: 8 Mar 2001 08:35:28 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Small perl sort question
Message-Id: <slrn9aeh2g.62i.abigail@tsathoggua.rlyeh.net>
Bob Walton (bwalton@rochester.rr.com) wrote on MMDCCXLVI September
MCMXCIII in <URL:news:3AA6EAC3.FD3485FC@rochester.rr.com>:
)) Bryan Coon wrote:
)) ...
)) > With the following array:
)) > my @list = ("5", "8", "15", "X", "7", "Y");
)) >
)) > my @sorted = sort { $a <=> $b } @list;
)) >
)) > works like a charm, with the exception that I get complaints that
)) > 'Argument "Y" isn't numeric in sort at.. etc.' . This is not such a
)) > problem, but is there a generally accepted way to use this sort after a
)) > test for numerics? This seems simple but I was unable to find such a
)) > test.... It is also not important that the strings are sorted.
)) ...
)) Well, the easiest thing is to just turn off warnings for the sort:
))
)) {
)) local $^W=0;
)) my @sorted = sort { $a <=> $b ) @list;
)) }
That's going to be a lot of fun when there are negative numbers.
Or 0's and strings.
Abigail
--
$_ = "\x3C\x3C\x45\x4F\x54"; s/<<EOT/<<EOT/e; print;
Just another Perl Hacker
EOT
------------------------------
Date: Thu, 08 Mar 2001 08:25:14 GMT
From: harri@tolppa.kotisivupalvelu.fi (Harri Haataja)
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <slrn9aegd4.hf3.harri@tolppa.kotisivupalvelu.fi>
Nils O. Selåsdal wrote:
>"Harri Haataja" <harri@tolppa.kotisivupalvelu.fi> wrote in message
>news:slrn9ac6nj.f6q.harri@tolppa.kotisivupalvelu.fi...
>> Terrence Brannon wrote:
>> >
>> >But think about Perl/Tk instead of gtk+. More stable and what you
>> >learn will allow you to use Tk on multiple programming languages.
>visualtcl , a great building GUI with tcl, get it at www.sourceforge.org
>> I have been recently wondering on what UI could I use with the perl things
>> I keep as pets. =)
>>
>> GTK is nice and looks good and all but is an absolute pig when used over a
>> network. I also don't want to use/learn/install tk. I'm looking at Motif
>> (cpan: X11) now as that would seem appropriate for the sparc/HP
>environment.
>I'd really take a serious look at Qt if i vere you, its clean, looks nice
>and easyto
>use yet powerful. And crossplatform across most unix and windows.
>www.trolltech.no
>or www.kde.org to see the power of it ;)
No. It's completely useless and ugly and did I mention I don't want a new
toolkit? Not without significant gain at least.
And did I mention I HATE qt for look and especially feel and it's
totally useless in my opinion?
.. and then there's the point of personal hatred to the way qt works.
... or doesn't work. Anyway, thanks for the view =)
--
Life -- Story by Kafka, illustration by Dali
------------------------------
Date: Thu, 08 Mar 2001 08:26:52 GMT
From: harri@tolppa.kotisivupalvelu.fi (Harri Haataja)
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <slrn9aegg6.hf3.harri@tolppa.kotisivupalvelu.fi>
Daniel Berger wrote:
>Harri Haataja wrote:
>> Terrence Brannon wrote:
>> >Kenny Pearce <kenny@kennypearce.net> writes:
>>
>> I have been recently wondering on what UI could I use with the perl things
>> I keep as pets. =)
>>
>> GTK is nice and looks good and all but is an absolute pig when used over a
>> network. I also don't want to use/learn/install tk. I'm looking at Motif
>> (cpan: X11) now as that would seem appropriate for the sparc/HP environment.
>>
>> Any other views?
>
>Motif? If you like writing 2-3 times as much code as you would in Java or Tk, sure
>it's nice. I'll sell you my O'Reilly Motif books - cheap.
Java? Did I say gui for perl things? Hmm.. yes.
Java is a gui for perl?
So is it the perl motif binds make more work?
Anyone using them?
--
Life -- Story by Kafka, illustration by Dali
------------------------------
Date: Thu, 08 Mar 2001 10:57:28 +0100
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <3AA75788.3CF1C6D2@bigfoot.com>
Daniel Berger wrote:
> As for speed, I have *yet* to see a Java app that was as fast or faster than Perl/Tk,
> or Perl in general for that matter.
I parse XML with Java because it is a _lot_ faster than with Perl.
--
Thorbjørn Ravn Andersen "...sound of...Tubular Bells!"
http://bigfoot.com/~thunderbear
------------------------------
Date: Thu, 8 Mar 2001 11:29:00 +0100
From: "Nils O. Selåsdal" <noselasd@frisurf.no>
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <p9Jp6.10054$t21.271478@news3.oke.nextra.no>
>
> No. It's completely useless and ugly and did I mention I don't want a new
> toolkit? Not without significant gain at least.
> And did I mention I HATE qt for look and especially feel and it's
> totally useless in my opinion?
Your opinion. (the look one can easily change). my opinion is that its the
best toolkit in *nix world.
And the event model is great. Hadnt t been for KDE2, id never used linux as
a desktop computer.
------------------------------
Date: Thu, 08 Mar 2001 11:33:16 GMT
From: harri@tolppa.kotisivupalvelu.fi (Harri Haataja)
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <slrn9aerdl.hv4.harri@tolppa.kotisivupalvelu.fi>
Nils O. Selåsdal wrote:
>>
>> No. It's completely useless and ugly and did I mention I don't want a new
>> toolkit? Not without significant gain at least.
>> And did I mention I HATE qt for look and especially feel and it's
>> totally useless in my opinion?
>Your opinion. (the look one can easily change). my opinion is that its the
>best toolkit in *nix world.
>And the event model is great. Hadnt t been for KDE2, id never used linux as
>a desktop computer.
Opinion, yes. That's why I asked for more and thanked for what I got =)
I would really like to stick to a more UNIX-ish way. QT looks like
running an emulator =)
--
Life -- Story by Kafka, illustration by Dali
------------------------------
Date: Thu, 08 Mar 2001 10:26:13 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: What information can I get from a GLOB reference?
Message-Id: <3AA75D22.927D5499@free.fr>
John Lin wrote:
> Although it can compile and run, I think it is not what I want.
> How can I get the valid keys of *foo{THING} here?
perlref answers:
*foo{THING} returns a reference to the THING slot in *foo (which
is the symbol table entry which holds everything known as foo).
$scalarref = *foo{SCALAR};
$arrayref = *ARGV{ARRAY};
$hashref = *ENV{HASH};
$coderef = *handler{CODE};
$ioref = *STDIN{IO};
$globref = *foo{GLOB};
Jerome.
------------------------------
Date: 8 Mar 2001 09:33:31 GMT
From: dcutter@gmx.de
Subject: Re: word boundary example
Message-Id: <987jlb$b6t$1@news.netmar.com>
In article <985n0g$nn8$1@newsg4.svr.pol.co.uk>, francesca
<plusc@freeserve.net> writes:
>Could someone please give me a simple code example
>to demonstrate how this word boundary checker
>will identify any words repeated. thanks
>
>
>if (/(\b.+\b) \1/)
>{
> print "Found $1 repeated\n";
>}
your regex will grab the entire line/file. for words try /\b\w+\b/ or
/\b.*?\b/. see 'perldoc perlre' for details.
Daniel
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 443
**************************************