[8525] in Perl-Users-Digest
Perl-Users Digest, Issue: 2142 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 20 05:07:10 1998
Date: Fri, 20 Mar 98 02:00:43 -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, 20 Mar 1998 Volume: 8 Number: 2142
Today's topics:
ANNOUNCE: Math::MagicSquare 1.10 module <pivari@geocities.com>
Authorization of porxy <mhchau@cse.cuhk.edu.hk>
Re: Backreference problem (Craig Berry)
Re: CGI script failing...asking for hint re: error msg (David Ashley)
Re: CGI script failing...asking for hint re: error msg (Roy Stogner)
Re: Challenge your programming skill <rjk@coos.dartmouth.edu>
Re: Contents of a file into checkbox's [CGI.pm] (tony)
Re: Dynamically checking for existing functions (Bart Lateur)
Re: grammar errors <mail-me@psu.edu>
Re: Help with Perl code <ravic@spamless.ms.com>
Re: Help with Perl code (Craig Berry)
Re: Help with Perl code parkesb@yahoo.com
Re: Help with Perl code <c..bojswbo@93.usenet.us.com>
Re: Help with Perl code (Bart Lateur)
Re: Help <rjk@coos.dartmouth.edu>
Re: MAPILogon Issues With Perl32 <MHammond@skippinet.com.au>
Opening dirs in Win32 <giles@agentware.com>
Re: Perl Daemons ( Mark Kucera)
Re: Perl Daemons ( Mark Kucera)
Re: perl script won't work as cgi ( Mark Kucera)
Re: regexp not working:help <mail-me@psu.edu>
solved [Re: s?\s[a-z][sd]t\s[12][90]? ? doesn't remove <mail-me@psu.edu>
Sorting data by a numberical key <reilly@ozy.dec.com>
Storing and sorting numerical keys <reilly@ozy.dec.com>
Re: trying to rename DIRECTORY in perl (Wesley)
Wanted: Perl for Windows 3.x <Use-Author-Address-Header@[127.1]>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 20 Mar 1998 09:54:58 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: Math::MagicSquare 1.10 module
Message-Id: <35123CF2.BD69D23D@geocities.com>
What is Math::MagicSquare module?
The first purpose of this PERL module is to help you to check your
Square, to answer these questions
Is it a Semimagic Square?
Is it a Magic Square?
The second purpose of this PERL module is to help you to print your
Square.
At the moment the method available is 'print' that prints the square on
STDOUT.
I'd like to add
- printhtml (to print the square in HTML format)
- pringif (to print the square in a GIF image)
- prinpdf (to print the square in PDF format)
What is a Magic Square?
Do you like Magic Square?
Do you want to know more information about Magic Square?
Try to visit
A very good introduction on Magic Square
http://www.astro.virginia.edu/~eww6n/math/MagicSquare.html
A whole collection of links and documents in Internet
http://www.pse.che.tohoku.ac.jp/~msuzuki/MagicSquare.html
A good collection of strange Magic Square
http://www.geocities.com/CapeCanaveral/Lab/3469/examples.html
The only Magic Square checker and gif maker in Internet (I think)
http://www.geocities.com/CapeCanaveral/Lab/3469/squaremaker.html
What's new with version 1.10
Added Panmagic Square test in check method
Where can I find it?
http://www.geocities.com/CapeCanaveral/Lab/3469/Math-MagicSquare.html
is the primary location
You also can find it at CPAN archive
Enjoy it!
Send me your suggestions.
--
Fabrizio Pivari
mailto:pivari@geocities.com
http://www.geocities.com/CapeCanaveral/Lab/3469/
Member of ANFACE Software
http://www.geocities.com/CapeCanaveral/Hangar/4794/
------------------------------
Date: 20 Mar 1998 08:27:01 GMT
From: Sleep <mhchau@cse.cuhk.edu.hk>
Subject: Authorization of porxy
Message-Id: <6et98l$67v@eng-ser1.erg.cuhk.edu.hk>
Hello ,
Can anyone tell me how to authorize a proxy server (etc give user name &
password ) ?
I am blocked by the firewall ...
Thank you for your attention!
regards,
Chau
------------------------------
Date: 20 Mar 1998 06:35:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Backreference problem
Message-Id: <6et2ns$i3r$1@marina.cinenet.net>
Dan Boorstein (dboorstein@shopcfn.com) wrote:
: Craig Berry wrote:
: > Still better (in my view) is
: >
: > $StringToBeChanged =~ s/_/01_/;
: >
: > which removes the need for the match variable entirely.
:
: perhaps it does, but it also changes the meaning of the regex. consider:
: $StringToBeChanged = 'double_trouble_test';
True enough. If you need the same last-underscore-only behavior, the
match variable method may be best.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 20 Mar 1998 05:56:17 GMT
From: dash@netcom.com (David Ashley)
Subject: Re: CGI script failing...asking for hint re: error msg
Message-Id: <dashEq3sHt.DDE@netcom.com>
In article <01bd53ae$8b7a39a0$a26c42ce@zaika>,
Alex Lane <alexlane@ghg.net> wrote:
>I have a RedHat Linux 4.2 box set up and am trying to run a cgi script
>written in Perl.
>
>An attempt is apparently being made to execute the script, but the
>following appears in the error_log file:
>
>exec of <script name and path> failed, errno is 2
><date/time> access to <script name and path> failed for <user>, reason:
>Premature end of script headers.
>
>Might someone be able to shed some light on what's wrong here? Thanks in
>advance.
>
>Cheers...
>alexlane@ghg.net ...speaking only for myself
>Seabrook, Texas http://www.ghg.net/alexlane
>PGP fingerprint: 7FDB06E2478479B4 323CA94865AA5BC2
>"No plan survives initial contact with the enemy." -- Von Moltke
>"...but without a plan, *you* will not survive." -- Lane
>
The script has to print out, first of all, something like
Content-type: text/html\n\n
That would be my guess.
Try this:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, world!<br>";
--
David Ashley dash@epyx.com
http://www.epyx.com/dash
SPAMMERS: You have nothing I want, don't send me email.
------------------------------
Date: 20 Mar 1998 08:00:53 GMT
From: roystgnrNO@SPAMiname.com (Roy Stogner)
Subject: Re: CGI script failing...asking for hint re: error msg
Message-Id: <slrn6h48dn.53l.roystgnrNO@roystgnr.jones.rice.edu>
On Fri, 20 Mar 1998 05:56:17 GMT, David Ashley <dash@netcom.com> wrote:
>In article <01bd53ae$8b7a39a0$a26c42ce@zaika>,
>Alex Lane <alexlane@ghg.net> wrote:
>>I have a RedHat Linux 4.2 box set up and am trying to run a cgi script
>>written in Perl.
>>
>>exec of <script name and path> failed, errno is 2
>><date/time> access to <script name and path> failed for <user>, reason:
>>Premature end of script headers.
>
>The script has to print out, first of all, something like
>Content-type: text/html\n\n
>
>That would be my guess.
>
>Try this:
>#!/usr/bin/perl
>print "Content-type: text/html\n\n";
>print "Hello, world!<br>";
I agree this is probably the problem - I should point out also that if
you aren't already using the CGI perl module, you might find it
useful. I forget whether it's on RH4.2 or not (using 5.0 now), but
try "man CGI".
---
Roy Stogner
------------------------------
Date: Fri, 20 Mar 1998 01:21:11 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Kim Lo <kiml@zplace.com>
Subject: Re: Challenge your programming skill
Message-Id: <35120ADA.6B770814@coos.dartmouth.edu>
[posted and mailed]
Kim Lo wrote:
>
> The problem I am having with this algorithm is that it could take a long
> time to compute as the number of customers grow. To minimize computing,
> I thought of just getting customers from the same state as the input
> zipcode and compute those only. The caveat to this approach is that for
> someone that lives closeby 2 states (especially on the East Coast), this
> may return incorrect result.
What if you kept a hash of zipcodes to adjacent zipcodes? For example,
%zip_to_adj = (
'48104' => [ qw(48103 48105 ...) ],
...
);
Then you could skip all the computation for customers who don't live in the
specified zip code or an adjacent one. It'll probably be a pain to make the
hash, but it could give you a big win in speed.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 20 Mar 1998 17:04:38 +1000
From: td@lavalink.com.au (tony)
Subject: Re: Contents of a file into checkbox's [CGI.pm]
Message-Id: <td-2003981704380001@mtterror.lavalink.com.au>
Thanks for the help.
This seems to do the trick.
> Try @my_file_contents = split(/\s+/, <INPUT>) instead. Also put "-w"
> on the #! line, and "use strict;" at the top of the file. You'll have
> to add "my" statements for the new variables, though.
Tony Delov
------------------------------
Date: Fri, 20 Mar 1998 09:18:05 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Dynamically checking for existing functions
Message-Id: <3516284b.3472358@news.tornado.be>
Andrew M. Langmead wrote:
>bart.mediamind@tornado.be (Bart Lateur) writes:
>>"defined \&coder" would have made more sense, I think. But why does
>
>> print \&James;
>
>>print something like "CODE(0x153b14)", even though sub James was not
>>defined?
>
>Weird. At first I thought it was some sort of autovivication, but it
>doesn't exist afterward.
I'll take a stab. One of the Perl porter guru's might comment about how
good a stab it is. My guess is that whenever Perl thinks of something in
code as a sub, it is initialized to default code that dies with a
message like "Attempt to invoke sub %s without definition" (replacing %s
with the sub's name). So, it's the location of this error trapping code
you see here.
Bart.
------------------------------
Date: Fri, 20 Mar 1998 03:03:04 -0500
From: parv <mail-me@psu.edu>
Subject: Re: grammar errors
Message-Id: <351222A7.6A5B@psu.edu>
obviuosly, i wrote:
> i was tempted to say what harm would it do, if i am going to log the
> visits to a page. then, i remembered that i 've to, also, sort the
> logfile. w/o 20 in the year , in future, will imply to a change in a
> script that will analyze the logfile.
sorry eveyone for my grammar errors. it should 've been:
i was tempted to say what harm would it do if i was going to log the
visits to a page. then, i remembered that i 'd to, also, sort the
logfile. w/o 20 in the year, in future, will imply to a change in a
script that will analyze the logfile.
------------------------------
Date: Fri, 20 Mar 1998 15:17:50 +0900
From: "Ravi C. Kumar" <ravic@spamless.ms.com>
To: MARK AMBROSE <n2007363@sparrow.qut.edu.au>
Subject: Re: Help with Perl code
Message-Id: <6et1mg$rvd@sanews1.morgan.com>
Mark,
First split the fields, then it is real easy with regex
try s/(.)\1/(\1\1)/g on the first split variable, this may not
the most efficient, but a good start. Also, note that this
will parenthesize an expression with three same chars such
as 'trrr xttt' to 't(rr)r x(tt)t' etc.,
Ravi
MARK AMBROSE wrote:
> With the use of Regular Expressions, how do I code it so that in a
> particular line of text, it recognises instances of double letters, or
> double characters, and makes them appear in parentheses.
>
> For example, if a line of text had :-
>
> John Rutter : 23423423 : Chicago
>
> It would print out
>
> John Ru(tt)er : 23423423 : Chicago
>
> Any help appreciated
>
> Regards, Mark
--
reply ADDR: ravic@ms.com
Ravi C. Kumar/ Morgan Stanley (Japan)
------------------------------
Date: 20 Mar 1998 06:43:50 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help with Perl code
Message-Id: <6et376$i3r$2@marina.cinenet.net>
MARK AMBROSE (n2007363@sparrow.qut.edu.au) wrote:
: With the use of Regular Expressions, how do I code it so that in a
: particular line of text, it recognises instances of double letters, or
: double characters, and makes them appear in parentheses.
:
: For example, if a line of text had :-
:
: John Rutter : 23423423 : Chicago
:
: It would print out
:
: John Ru(tt)er : 23423423 : Chicago
Assuming that you want to look for doubled letter, digits, or underlines
(so we can use the convenient \w word-char class), this does the trick:
s/(\w\1)/($1)/g
That is, find word char immediately followed by the same char, and
replace it with that same pair wrapped in parentheses.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 20 Mar 1998 00:56:11 -0600
From: parkesb@yahoo.com
Subject: Re: Help with Perl code
Message-Id: <6et3u6$sbe$1@nnrp1.dejanews.com>
Mark,
s/(\w)\1/($1$1)/g
will do what you wish.
For an explanation
man perlre
Brian
In article <Pine.OSF.3.93.980320130756.28418A-100000@sparrow.qut.edu.au>,
MARK AMBROSE <n2007363@sparrow.qut.edu.au> wrote:
>
> Just a little help to a newbie please...
>
> With the use of Regular Expressions, how do I code it so that in a
> particular line of text, it recognises instances of double letters, or
> double characters, and makes them appear in parentheses.
>
> For example, if a line of text had :-
>
> John Rutter : 23423423 : Chicago
>
> It would print out
>
> John Ru(tt)er : 23423423 : Chicago
>
> Any help appreciated
>
> Regards, Mark
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 20 Mar 1998 08:38:54 GMT
From: Anirvan Chatterjee <c..bojswbo@93.usenet.us.com>
Subject: Re: Help with Perl code
Message-Id: <6et9uu$5pr$1@samba.rahul.net>
MARK AMBROSE <n2007363@sparrow.qut.edu.au> wrote:
> With the use of Regular Expressions, how do I code it so that in a
> particular line of text, it recognises instances of double letters, or
> double characters, and makes them appear in parentheses.
$string = 'John Rutter : 23423423 : Chicago';
$string =~ s/(.)\1/($1$1)/g;
print $string, "\n";
yields the following as output
John Ru(tt)er : 23423423 : Chicago
Here's the substitution again (labeled by part):
1 2 3 4
s/(.)\1/($1$1)/g
Part 1 matches any character. Because its in parentheses, it's
captured to $1 (and is accessible within the regex as "\1")
Part 2 repeats the first match. Together, 1 and 2 will match any
character followed by the same character.
Part 3 prints the matched string in parentheses.
Part 4 (the "g" modifier) ensures that the substitution is run for
every time the regex is matched.
See the "perlre" manpage for more info. HTH.
_____________________________________________________________________
Anirvan Chatterjee . anirvan @ chatterjee.net . PGP 2048/0xE2D13BA9
Fast & free new/used multi-bookstore searching @ http://www.mxbf.com/
------------------------------
Date: Fri, 20 Mar 1998 09:18:09 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Help with Perl code
Message-Id: <3515270a.3157253@news.tornado.be>
Craig Berry wrote:
> s/(\w\1)/($1)/g
I wouldn't think this can possibly work. On the left side, \1 is
referencing to something containing itself. Could I call this a
recursive definition?
Anyway, I tested it, and it simply puts every single letter and digit
between parentheses. No trace of any recursion.
BTW this DOES work as advertised:
s/((\w)\2)/($1)/g;
Bart.
------------------------------
Date: Fri, 20 Mar 1998 01:27:14 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Birjinder Singh Anant <bsanant@uclink.berkeley.edu>
Subject: Re: Help
Message-Id: <35120C47.3674EC6D@coos.dartmouth.edu>
[posted and mailed]
Birjinder Singh Anant wrote:
>
> Use of uninitialized value at ./split.pl line 10<BIRJ> chunk 1(-6)
>
> my(@records) = &splitLine($_);
> print $records[0], "\n";
Given the atrocious formatting of your code when you posted it, I can only
assume this is line 10. $records[0] must be unitialized in certain cases.
> #splitLine returns an array made from elements on the line
There must be a case in which it returns a null array.
The indentation of your code is so bad that it would take too much effort for
me to figure out the problem.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 20 Mar 1998 11:26:17 +1000
From: "Mark Hammond" <MHammond@skippinet.com.au>
Subject: Re: MAPILogon Issues With Perl32
Message-Id: <6et48a$g1t$4@arachne.labyrinth.net.au>
>The script will run on a server, called by server application (Remedy), and
>needs to be able to send mail without a user being logged on. That means I
can't
>use a profile.
The script must be running as _someone_. If noone is logged in, it implies
a service.
Further, MAPI is going to insist it knows who you are - you obviously must
provide a user name of mailbox name or something to MAPI - there is no magic
it can perform for you.
A simple solution is to set up the Exchange profile under the user the
service runs under. This works fine.
As you discovered, it does not seem trivial to create a profile on the fly.
If you look in the SDK, you can find the sources to the
HrCreateGatewayProfile/HrCreateAgentProfile (or something like that) which
show how non-trivial the task can be...
[One alternative is to use Perl to send SMTP mail instead of MAPI mail.
Less authentication issues.
Better alternative is to use Python for Windows - much nicer syntax and
language than Perl (IMHO, of course :-) and has full support for SMTP,
native MAPI, NT Serivces, COM/Active Messaging, etc etc etc.
http://www.python.org/windows (same issues would apply to any language tho,
of course)
]
Mark.
------------------------------
Date: Thu, 19 Mar 1998 20:54:32 -0800
From: "Beau Giles" <giles@agentware.com>
Subject: Opening dirs in Win32
Message-Id: <6esssb$le6$1@owl.slip.net>
I've got an odd little bug that's hit me in porting a cgi script from Unix
to Windows. I've got a variable passed through STDIN representing a
directory in a file system ($PWD).
I've massaged it with the following lines:
$PWD =~ s/%3A/:/g;
$PWD =~ s/%5C/\\/g;
to replace the substitution done by passing through post. A test value I
passed in was "C:\temp" and checking afterward by printing the value, that's
what I see. However if I do
$foo = ($PWD eq "C:\\tmp") ? "yes" : "no";
the answer will be no. And if I try to
opendir (DIR, $PWD) or die "Can't open $PWD: $!";
The script will always die here, whereas
opendir (DIR, "C:\\temp") or die "Can't open $PWD: $!";
works. This method of passing directories worked on Unix (with different
file separator substitution), does anyone know what I'm missing?
-- Beau Giles
San Francisco, Ca
------------------------------
Date: Fri, 20 Mar 1998 18:27:32 GMT
From: kucera@mindsrping.com ( Mark Kucera)
Subject: Re: Perl Daemons
Message-Id: <3512b4b6.5060646@news.mindspring.com>
this does help, but you still need something to invoke the script that
invokes the script yes?? i am going to see if i can find info about
making perl compile to native code, and using the os (unix based) to
try to schedule the daemon hopefully that will do some good
thanks
mark kucera
On 20 Mar 1998 02:50:47 GMT, neilb@zetnet.co.uk (Neil Briscoe) wrote:
>In article <3512389d.8190327@news.mindspring.com>, kucera@mindsrping.com (
>Mark Kucera) wrote:
>
>> hi, i have a perl script that i want to make into a daemon. how would
>> i go about doing it?
>>
>> i have seen some programs for win32 that change perl scripts to exe
>> files? is there a similar program for unix?
>>
>> thanks for your help..
>>
>
>There is a Perl compiler which will turn most perl into native executable
>code - see http://www.perl.com for details.
>
>That, of itself, however, will not make your code into a daemon.
>
>A daemon is normally characterised by the fact that, if invoked from the
>command line, it will subsequently detach itself from the terminal and
>run, until terminated by a signal.
>
>The code to do this is :-
>
>#!/usr/local/bin/perl
>
>if (fork()) { # Invoke a child
> if (fork()) { # Child invokes a grandchild
> while (($pid = getppid()) !- 1) { # Wait until init adopts us
> sleep(1);
> }
> do_stuff(); # Go and do what our daemon does
> exit;
> }
> exit; # Child immediately dies, orphaning grandchild
>}
>wait; # Wait for child, and reap it
>exit;
>
>sub do_stuff {
> # Your code goes here
>}
>
>I hope the above helps.
>
>Regards
>Neil
>
>
------------------------------
Date: Fri, 20 Mar 1998 18:28:54 GMT
From: kucera@mindsrping.com ( Mark Kucera)
Subject: Re: Perl Daemons
Message-Id: <3512b543.5201359@news.mindspring.com>
this program to compile perl, is it the perl2exe utility? if so is
there something for unix compilation?
mark
On 20 Mar 1998 02:50:47 GMT, neilb@zetnet.co.uk (Neil Briscoe) wrote:
>In article <3512389d.8190327@news.mindspring.com>, kucera@mindsrping.com (
>Mark Kucera) wrote:
>
>> hi, i have a perl script that i want to make into a daemon. how would
>> i go about doing it?
>>
>> i have seen some programs for win32 that change perl scripts to exe
>> files? is there a similar program for unix?
>>
>> thanks for your help..
>>
>
>There is a Perl compiler which will turn most perl into native executable
>code - see http://www.perl.com for details.
>
>That, of itself, however, will not make your code into a daemon.
>
>A daemon is normally characterised by the fact that, if invoked from the
>command line, it will subsequently detach itself from the terminal and
>run, until terminated by a signal.
>
>The code to do this is :-
>
>#!/usr/local/bin/perl
>
>if (fork()) { # Invoke a child
> if (fork()) { # Child invokes a grandchild
> while (($pid = getppid()) !- 1) { # Wait until init adopts us
> sleep(1);
> }
> do_stuff(); # Go and do what our daemon does
> exit;
> }
> exit; # Child immediately dies, orphaning grandchild
>}
>wait; # Wait for child, and reap it
>exit;
>
>sub do_stuff {
> # Your code goes here
>}
>
>I hope the above helps.
>
>Regards
>Neil
>
>
------------------------------
Date: Fri, 20 Mar 1998 18:23:18 GMT
From: kucera@mindsrping.com ( Mark Kucera)
Subject: Re: perl script won't work as cgi
Message-Id: <3512b3ac.4794153@news.mindspring.com>
are there any file system restrictions running on your server? if so
that would be a problem. when you run the program from the command
prompt, you are execting it as a specifi user when netscape or
internet explorer run your program, they are given a name system:any
user.
so you might want to change the directory/file permisions
fs sa . system:anyuser all
in the directory you are tring to run your script from might help.
mark kucera
On Thu, 19 Mar 1998 14:51:11 -0700, "Doran L. Barton"
<fozz@mail.xmission.com> wrote:
>I don't see the required MIME headers anywhere in your code. Add this at the
>top of your script:
>
>print "Content-type: text/html\n\n";
>
>-Fozz
>
>Brian Charles wrote:
>
>> Why won't this PERL script work as a CGI script. It runs fine at the
>> command prompt but not over the web.
>> Any suggestions?
>> (PS cgi newsgroups has some problems, that's why I post here)
>> Thanks
>>
>> #!/usr/bin/perl
>>
>> open DB,"file1" or die "Cannot open myfile: $!";
>>
>> while(<DB>) {
>> chomp;
>> ($firstname,$lastname,$email,$code) = split /\|/;
>> $hash{$firstname} = {lastname => $lastname, email => $email, code
>> =>$code};
>> }
>>
>> for $firstname ( sort by_fullname keys %hash ) {
>> print "$firstname $hash{$firstname}{lastname} $hash{$firstname}{email}
>> ",
>> "$hash{$firstname}{code}\n";
>> }
>>
>> sub by_fullname {
>> $hash{$a}{lastname} cmp $hash{$b}{lastname}
>>
>> }
>
>
>
>--
>========================================================================
>Doran L. Barton = fozz@xmission.com && http://www.xmission.com/~fozz/;
>"You're spending too much time online when you start referring to going
> to the bathroom as downloading."
>
>
------------------------------
Date: Fri, 20 Mar 1998 02:13:51 -0500
From: parv <mail-me@psu.edu>
Subject: Re: regexp not working:help
Message-Id: <35121723.2F04@psu.edu>
Dave Barnett wrote:
> print scalar(localtime(time)), "\n";
>
> to see what you get?
>
> I think you might be surprised.
>
> I get:
> Wed Mar 18 11:20:24 1998
and i get...
Fri Mar 20 02:10:07 1998
and yes you/perl did surprise me. guess that will cut down the regexp
(i 'm working on it).
thanks dave.
- anu
------------------------------
Date: Fri, 20 Mar 1998 02:53:38 -0500
From: parv <mail-me@psu.edu>
Subject: solved [Re: s?\s[a-z][sd]t\s[12][90]? ? doesn't remove 19]
Message-Id: <35122072.F62@psu.edu>
Quentin Fennessy wrote:
> And you want to chop it to
>
> Wed Mar 18 08:46:09 98
>
> Just answering your question, trying to avoid Y2K bugs, but
> not entirely succeeding:
>
> $time =~ s/[A-Z][DS]T [0-9]{2}//i;
>
> You were perhaps not matching case exactly for the timezone field,
> although you neglected to provide example data.
on my system(unix, perl 5.003), actually univeristy's, i get:
Fri Mar 20 02:32:30 EST 1998
still the above regexp doesn't remove the 19. does it work for you?
however, that will not be neccessary anymore. thanks to dave barnett for
suggesting to use...
$time = scalar(localtime(time)) ;
...to get 'rid' of the timezone (text). then i get removed the 19 like
so...
$time =~ s/(:[0-9]{2} )[0-9]{2}/$1/ ;
which prints ($time)...
Fri Mar 20 02:33:30 98
> You may want to avoid doing this altogether, as sooner than later
> 98 will be 00, and hell will have broken looser than it is even
> now.
i was tempted to say what harm would it do, if i am going to log the
visits to a page. then, i remembered that i 've to, also, sort the
logfile. w/o 20 in the year , in future, will imply to a change in a
script that will analyze the logfile. thanks queintin, for saving my
butt.
- anu
------------------------------
Date: Fri, 20 Mar 1998 11:11:52 +1000
From: David Reilly <reilly@ozy.dec.com>
Subject: Sorting data by a numberical key
Message-Id: <3511C257.558543B9@ozy.dec.com>
I want to store information (a line of text), using as my key
a numberical number (hh:mm:ss), and then sort them.
I was going to use an associative array, but often the
data will have the same key, so I'd be overwriting anything
that has a duplicate.
Sample data
00:00:00 line of text
00:05:01 another line
00:00:00 second line of text
Sample output
00:00:00 line of text
00:00:00 second line of text
00:05:01 another line
or
00:00:00 second line of text
00:00:00 line of text
00:05:01 another line
------------------------------
Date: Fri, 20 Mar 1998 11:09:46 +1000
From: David Reilly <reilly@ozy.dec.com>
Subject: Storing and sorting numerical keys
Message-Id: <3511C1DA.EBDBDD40@ozy.dec.com>
I want to store information (a line of text), using as my key
a numberical number (hh:mm:ss), and then sort them.
I was going to use an associative array, but often the
data will have the same key, so I'd be overwriting anything
that has a duplicate.
Sample data
00:00:00 line of text
00:05:01 another line
00:00:00 second line of text
Sample output
00:00:00 line of text
00:00:00 second line of text
00:05:01 another line
or
00:00:00 second line of text
00:00:00 line of text
00:05:01 another line
------------------------------
Date: 20 Mar 1998 05:02:28 GMT
From: wkc@dorsai.org (Wesley)
Subject: Re: trying to rename DIRECTORY in perl
Message-Id: <slrn6h3u5t.9u2.wkc@amanda.dorsai.org>
I'm trying to rename a directory on an NT. The "rename" in Perl doesn't
work on a directory. ANy one pls help.
Wesley
------------------------------
Date: Fri, 20 Mar 1998 14:34:02 -0600
From: Suranga Manage <Use-Author-Address-Header@[127.1]>
Subject: Wanted: Perl for Windows 3.x
Message-Id: <1.5.4.16.19980320144153.3c3f50e6@pop.netaddress.com>
Dear Friends,
I am a computer eng student, I want to learn some perl. However
I don't have access to a UNIX box. Is there a perl version that
can be run on MS-Windows 3.1 or MS-Dos ?. I know that there
is a perl flavour for MS-Windows NT but I am not in a position
to have access to a NT machine.
Thanks
Suranga
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 2142
**************************************