[15976] in Perl-Users-Digest
Perl-Users Digest, Issue: 3388 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 16 09:05:24 2000
Date: Fri, 16 Jun 2000 06:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961160711-v9-i3388@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 16 Jun 2000 Volume: 9 Number: 3388
Today's topics:
Re: (Q) meaning of &which("java") (Anno Siegel)
Re: Bot for this group to auto-answer queries? (Csaba Raduly)
Re: can't get CGI.pm to autoEscape ? <flavell@mail.cern.ch>
Emacs modules for Perl programming (Jari Aalto+mail.perl)
Re: Encrypting / decrypting. <thunderbear@bigfoot.com>
filled in fields <Simon@generalandmedical.co.uk>
Re: filled in fields <gedichte@lycosmail.com>
First day with Perl <fischers@pinuts.de>
Re: flock() and blocking lock? nobull@mail.com
GIMP on G4 Mac <gasior@snet.net>
Re: how do i ignore special chars in a string? <abe@ztreet.demon.nl>
List all hosts of a subdomain with Net::DNS? <Reiner_Buehl@hp.com>
List all hosts of a subdomain with Net::DNS? <Reiner_Buehl@hp.com>
Re: Numbers and RE <debjit@oyeindia.com>
Re: OT: Re: Taryag Perl <micha@aishdas.org>
Re: Problem spawning process on winnt <pds@x-datcon.co.uk>
Problems with Chart::Graph (Rob Zwartjes)
Re: Scripts work from shell but not browser <debjit@oyeindia.com>
Re: Scripts work from shell but not browser <tfm@sei.cmu.edu>
Re: Sorting a ':' delimeted file by a field value/surna <jimmy.lantz@ostas.lu.se>
Re: Ugh (Helgi Briem)
Unix database for Perl <btate@primary.net>
Re: Unix database for Perl VincentMurphy@mediaone.net
Re: Up-to-date Perl for OS/2? (Csaba Raduly)
Validating TCP Address Format <S.Webb@ftel.co.uk>
Re: Validating TCP Address Format VincentMurphy@mediaone.net
Re: Validating TCP Address Format <S.Webb@ftel.co.uk>
Re: Where are the error logs? <flavell@mail.cern.ch>
Re: Where are the error logs? <Peter.Dintelmann@dresdner-bank.com>
Re: Where is a Perl/CGI site. (Bart Lateur)
Re: why does this code print two spaces? <Peter.Dintelmann@dresdner-bank.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Jun 2000 11:36:26 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: (Q) meaning of &which("java")
Message-Id: <8id3fq$b38$1@lublin.zrz.tu-berlin.de>
Tad McClellan <tadmc@metronet.com> wrote in comp.lang.perl.misc:
>On Thu, 15 Jun 2000 02:13:14 -0400, Nico Zigouras <zigouras@mail.med.upenn.edu> wrote:
>>Nothing wrong with the
>>double quotes either.
>
>
>It provides a false que.
>
>When I see double quotes, I figure they were used because you
>_needed_ one of the two things that they provide above what
>single quotes provide (interpolation and/or backslash escapes).
I tend to agree, though I'm not terribly dogmatic about it. In
fact, I find myself avoiding variable interpolation more and more,
indicating that I did so by the use of single quotes where possible.
By the same token, a widespread idiom ought to be challenged. We
often see
sub i_want_one_parameter {
my $param = shift;
# ...
}
Now, shift() has changed @_ which *should* indicate that the programmer
intends to use it further. You will have to check all of the code in
the sub to find that this is (often) not the case. By the rule that
you don't invoke a function you don't need, the correct way to access
a single parameter should be "my ( $param) = @_" or my "$param = $_[ 0]".
Both are a bit noisier that the common idiom, which is probably why it
is so common. But, Same Rules Apply to All[1].
Anno
[1] Can anyone tell I've been reading Irvine Welsh?
------------------------------
Date: 16 Jun 2000 10:23:57 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: Bot for this group to auto-answer queries?
Message-Id: <8F5572766quuxi@193.82.145.131>
15 Jun 2000: A formal bug report was sent to Seti@Home, because the
following message originated from henry@penninkilampi.net (Henry) was
reported as containing signs of intelligence:
>In article <slrn8kgi9g.570.tadmc@magna.metronet.com>,
>tadmc@metronet.com (Tad McClellan) wrote:
>
>> bot's are not appropriate on Usenet (IMO, of course).
>
>Once apon a time, civilians were not allowed on the Internet. Once
>apon a time, an education and a brain were pre-requisites.
>
>Times change.
>
>
[snip]
* Progress (n.): The process through which Usenet has evolved from
smart people in front of dumb terminals to dumb people in front of
smart terminals. -- obs@burnout.demon.co.uk
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
Life is complex, with real and imaginary parts.
------------------------------
Date: Fri, 16 Jun 2000 12:02:05 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: can't get CGI.pm to autoEscape ?
Message-Id: <Pine.GHP.4.21.0006161155090.8722-100000@hpplus03.cern.ch>
On 15 Jun 2000, Tony Curtis wrote:
> print a({href => $url}, 'click me!'), "\n";
>
> I can't get CGI not to munge the HTML, which means the
> link comes out with the query string as:
>
> ?a=1&b=2
In the HREF? That's exactly what it _should_ be.
See, for example, the discussion at
http://ppewww.ph.gla.ac.uk/~flavell/www/formgetbyurl.html
Of course, nothing becomes true merely by virtue of me saying that it
is so, but my web page does make reference to the authoritative
specifications, where you can check this for yourself.
There were problems with earlier versions of CGI.pm due to confusion
between what was a URI and what was the appropriate HREF or SRC
attribute value. It still may not be entirely transparent, but unless
you show more detail of your working, I'm having a hard time to put my
finger on just where it's going wrong in your scenario.
------------------------------
Date: 16 Jun 2000 12:08:18 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_961157256@rtfm.mit.edu>
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://home.eu.org/~jari/ema-keys.html
Maintainer: Jari Aalto <jari.aalto@poboxes.com>
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs
XEmacs/Emacs, is available to various platforms:
o Unix:
If you don't have one, bust your sysadm.
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
Emacs resources at http://home.eu.org/~jari/emacs-elisp.html
o W9x/NT:
http://www.gnu.org/software/emacs/windows/ntemacs.html
Emacs Perl Modules
Cperl -- Perl programming mode
.ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
.<olson@mcs.anl.gov> Bob Olson (started 1991)
.<ilya@math.ohio-state.edu> Ilya Zakharevich
Major mode for editing perl files. Forget the default
`perl-mode' that comes with Emacs, this is much better. Comes
starndard in newest Emacs.
TinyPerl -- Perl related utilities
.http://home.eu.org/~jari/tiny-tools-beta.zip
.http://home.eu.org/~jari/emacs-tiny-tools.html
If you ever wonder how to deal with Perl POD pages or how to find
documentation from all perl manpages, this package is for you.
Couple of keystrokes and all the documentaion is in your hands.
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Load source code into Emacs, like Devel::DProf.pm
o Grep through all Perl manpages (.pod)
o Follow POD manpage references to next pod page with TinyUrl
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
o TinyUrl is used to jump to URLs (other pod pages, man pages etc)
mentioned in POD pages. (It's a general URL minor mode)
TinyIgrep -- Perl Code browsing and easy grepping
[TinyIgrep is included in the tgz mentioned above]
To grep from all installed Perl modules, define database to
TinyIgrep. There is example in the tgz (ema-tigr.ini) that shows
how to set up datatbases for Perl5, Perl4 whatever you have
installed
TinyIgrep calls Igrep.el to run the find for you, You can adjust
recursive grep options, ignored case, add user grep options.
You can get `igrep.el' module from <kevinr@ihs.com>. Ask for copy.
Check also ftp://ftp.ihs.com/pub/kevinr/
TinyCompile -- Browsing grep results in Emacs *compile* buffer
TinyCompile is minor mode for *compile* buffer from where
you can collapse unwanted lines, shorten the file URLs
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT
-->
cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
file1:NNN: MATCHED TEXT
file1:NNN: MATCHED TEXT
End
------------------------------
Date: Fri, 16 Jun 2000 12:46:21 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Encrypting / decrypting.
Message-Id: <394A057D.C2227226@bigfoot.com>
"Godzilla!" wrote:
> You should know better than to try to fool
> the Goddess of Hackers.
What does Abigail have to do with this?
--
Thorbjørn Ravn Andersen "...plus...Tubular Bells!"
http://bigfoot.com/~thunderbear
------------------------------
Date: Fri, 16 Jun 2000 12:00:25 +0100
From: "Simon Christie" <Simon@generalandmedical.co.uk>
Subject: filled in fields
Message-Id: <8id1h6$9oc$1@gxsn.com>
I have a form that goes to a cgi script to email me
how can i check that a field has been filled in?
I know i can use javascript on the form page but i'd like to know how to
check it using perl.
Any help or if you could point me to a tutorial i would be very grateful
thanks in advance
------------------------------
Date: Fri, 16 Jun 2000 13:56:02 +0200
From: Johannes <gedichte@lycosmail.com>
Subject: Re: filled in fields
Message-Id: <394A15D2.74215393@lycosmail.com>
use CGI(param);
foreach (param) {
if (! defined param($_)) {
... # the field $_ was not filled in
}
}
Simon Christie wrote:
> I have a form that goes to a cgi script to email me
> how can i check that a field has been filled in?
> I know i can use javascript on the form page but i'd like to know how to
> check it using perl.
> Any help or if you could point me to a tutorial i would be very grateful
> thanks in advance
------------------------------
Date: Fri, 16 Jun 2000 12:59:01 +0200
From: STF <fischers@pinuts.de>
Subject: First day with Perl
Message-Id: <394A0875.7BF130CF@pinuts.de>
Hi there
I have some little questions:
Can i include Perl-code in HTML-files as easily as PHP-code?
And how do i do that?
What about executing PHP-commands from perl-code?
Problem is, i want to write some datas in a mysql database ... these
datas are content of input fields of an html-file.
How do i do this with perl?
Thx
STF
------------------------------
Date: 16 Jun 2000 12:26:28 +0100
From: nobull@mail.com
Subject: Re: flock() and blocking lock?
Message-Id: <u9itv9n9y3.fsf@wcl-l.bham.ac.uk>
usenet-9947@marc-haber.de (Marc Haber) writes:
> I understand the docs that the flock( FH, LOCK_EX ) call only returns
> if the lock has been successfully acquired. Hence, the "unless" clause
> marked A should never be executed. However, in a real environment, I
> keep getting "can't get lock on <filename>: Device or resource busy"
> errors.
I'm guessing this means that whatever structure is used to store the
queue of outstanding locks has reached some upper-bound.
This is almost certainly an OS issue related to the implementation of
the flock() syscall and not a Perl one.
Incidenly you say this is on Limux and my Linux flock() manpage does
not mention EBUSY as a possible return and nor does the kernel source.
The kernel source (but not the manpage) indicates that you'll get
ENOLCK (37 = No record locks available). Maybe you have an older
kernel that returns EBUSY rather than ENOLCK.
> What am I doing wrong here? Is there some kind of timeout after which
> even a blocking call to flock() will return without having acquired
> the lock?
Timeout? Do you mean flock() is not retuning EBUSY immediately?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 16 Jun 2000 12:43:45 GMT
From: Robert Gasiorowski <gasior@snet.net>
Subject: GIMP on G4 Mac
Message-Id: <394A2F90.B7EEC699@snet.net>
I'm trying to install GIMP on G4 running LinuxPPC 2000, but when I run
configure
I get message: can't recognize the platform configure manually
Any ideas?
------------------------------
Date: Fri, 16 Jun 2000 13:38:46 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: how do i ignore special chars in a string?
Message-Id: <c54kksg5us26f5f4hhhd5el40svlb70d4j@4ax.com>
On Thu, 15 Jun 2000 16:17:05 -0400, Drew Simonis <care227@attglobal.net>
wrote:
> No need to be sorry. As long as you learn. I think the theme for
> today is "we all make silly mistakes", the point is to learn from,
> instead of repeating, those mistakes.
>
> $ perldoc perlop (on UNIX systems)
Now why wouldn't that work on an Win32 system?
:-)
D:\>perldoc perldoc
--
Good luck,
Abe
------------------------------
Date: Fri, 16 Jun 2000 11:52:40 +0200
From: Reiner Buehl <Reiner_Buehl@hp.com>
Subject: List all hosts of a subdomain with Net::DNS?
Message-Id: <83ujksg6tca5948eth09gktv9vsce5abl9@4ax.com>
Hi,
I would like to list all hosts in a given subdomain. Using nslookup I can do
it using the "ls -t A" command of nslookup. Is there a similar command for
Net::DNS?
Best Regards,
Reiner Buehl.
------------------------------
Date: Fri, 16 Jun 2000 12:43:58 +0200
From: Reiner Buehl <Reiner_Buehl@hp.com>
Subject: List all hosts of a subdomain with Net::DNS?
Message-Id: <u61kkssuv5pou1rjl9mm4s68esuq79sr01@4ax.com>
Hi,
I would like to list all hosts in a given subdomain. Using nslookup I can do
it using the "ls -t A" command of nslookup. Is there a similar command for
Net::DNS?
Best Regards,
Reiner Buehl.
------------------------------
Date: Fri, 16 Jun 2000 17:09:52 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: Numbers and RE
Message-Id: <8ie8mh$cjm$1@news.vsnl.net.in>
this seems to work
#!/usr/bin/perl -w
my $str = qq` 1,000 becomes blank --or-- 1000 becomes blank
but SD5 stays as a valid entry.`;
$str =~s/\b(\d+\,*\d+)\b//g;
print $str;
Lauren Smith wrote in message <8ic1ks$mar$1@brokaw.wa.com>...
>
><newbie@db-networks.com> wrote in message
>news:qpviksobhuiegg6e2fieg4ksr64254n7lc@4ax.com...
>> I am trying unsuccessfully to make an RE that will:
>>
>> If it just a number then remove it. ie:
>> 1,000 becomes blank --or-- 1000 becomes blank
>> but SD5 stays as a valid entry.
>>
>> my $data[0] =~ s/\d+$//g;
>
>Make a variable blank if it doesn't contain an alpha character.
>
>$data[0] = '' unless ($data[0] =~ /[a-zA-Z]/);
>
>or
>
>$data[0] = '' if ($data[0] !~ /[a-zA-Z]/);
>
>Lauren
>
>
>
------------------------------
Date: 16 Jun 2000 12:54:44 GMT
From: Micha Berger <micha@aishdas.org>
Subject: Re: OT: Re: Taryag Perl
Message-Id: <8id82k$f3b$3@bob.news.rcn.net>
In soc.culture.jewish Larry Rosler <lr@hpl.hp.com> wrote:
: I don't know why it wasn't called betadeutera or something; but as for
: tau, what is Greek for 400? :-)
I think it's because different systems evolved, and gamma was the first
letter which uniquely identified the one that survived.
-mi
------------------------------
Date: Fri, 16 Jun 2000 13:59:46 +0100
From: "Paul D.Smith" <pds@x-datcon.co.uk>
Subject: Re: Problem spawning process on winnt
Message-Id: <8id8c7$c92$1@soap.pipex.net>
Perhaps you're having problems because you're trying to run a batch job.
Try running "cmd.exe" and passing the batch file as a parameter using the
"run then terminate" option from cmd.exe (see the NT help).
Paul DS
--
Please remove the "x-" if replying to sender.
"Ing. R. Uittenbosch" <uittenb@natlab.research.philips.com> wrote in message
news:3949DA0F.8F99A725@natlab.research.philips.com...
> Hello everybody,
>
> The problem is as follows :
> I want to start a lot of perl programs from within another one, but I do
not
> want to wait until the first finished to start the second and so on... On
unix
> it works just fine by putting it in the background, but on Winnt it keeps
giving
> problems.
>
> I already tried the Win32::Process::Create method but it keeps coming back
with
> an error or it doesn't do anything?!?! What am i doing wrong???
>
> The command is :
> Win32::Process::Create($process,
> "c:\\perl\\bin\\perl","$command",0,DETACHED_PROCESS,"$test_dir")
> In the $command var are the perlprogramname and it's parameter listed.
> When I put all in a batch file like :
> <<< test.bat >>>
> cd h:\projects\Validate\testdir
> perl h:\Projects\Validate\Bin\realtest.pl parameter parameter
> >>>
> and start it like
>
Win32::Process::Create($process,"c:\test\test.bat","test.bat",0,DETACHED_PRO
CESS,".")
> it does not give an error, but does not do anything either!!?!?!?!
>
> Thanks
> Robbert
>
> --
> Ing. R.B. Uittenbosch
> Philips Research Laboratories - Semiconductors.
> Building WAY2-70.
> Prof. Holstlaan 4
> 5656 AA Eindhoven, The Netherlands
> Phone : +31-(0)40-2742213
> Fax : +31-(0)40-2744115
>
> Email : uittenb@natlab.research.philips.com
------------------------------
Date: 16 Jun 2000 11:47:54 GMT
From: rzwartje@rob.home.nl (Rob Zwartjes)
Subject: Problems with Chart::Graph
Message-Id: <slrn8kk5nj.ned.rzwartje@rob.home.nl>
Hello Perlers,
this is a followup from my previous question concerning Perl -> Gnuplot. I
found out that there is a module Chart::Graph that supports Gnuplot. I run
the script below but:
#! /usr/bin/perl -w
#use Chart::Graph;
use Chart::Graph::Gnuplot qw(&gnuplot);
use Chart::Graph::Utils qw(:USER);
gnuplot( {"title" => "foo",
"x2-axis label" => "bar",
"logscale x2" => "1",
"logscale y" => "1",
"xtics" => [ ["small\\nfoo",10],["medium\\nfoo",20],["large\\nfoo",30]],
"ytics" => [10,20,30,40,50]},
[{"title" => "data1",
"type" => "matrix"}, [[1, 10],[2, 20],[3, 30]] ],
[{"title" => "data2",
"style" => "lines",
"type" => "columns"}, [8, 26, 50, 60, 70],
[5, 28, 50, 60, 70] ],
[{"title" => "data3","style" => "lines","type" => "file"}, "sample"],);
but there is no output to screen. Makarand Mulkami mentioned that I probably
have to use:
set term XXX
If this is the case where should I put it in this script; do I need a module
to use it? If so what module should I download ?
thanks in advance,
Rob
------------------------------
Date: Fri, 16 Jun 2000 15:50:01 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: Scripts work from shell but not browser
Message-Id: <8ie40t$b0u$1@news.vsnl.net.in>
Usually cgi scripts work in world permission. May be that is why u did not
have enough permission to open the file.
use the following two line at the top
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
You mayl get useful error message on the browser
Steve Harder-Kucera wrote in message
<03637eba.4ca32cc4@usw-ex0104-033.remarq.com>...
>>
>I recently moved them to a third server and now I am stumped. I
>started getting Internal Server Errors. I checked all the file
>permissions and paths, and the syntax checks out from the unix
>shell.
>
>I started to debug them line by line and found that they were
>>What is strange to me is that when I run the scripts via the unix
>shell, they work perfectly. No syntax errors, and they actually
>do what they are supposed to do.
>
>The version of perl where they work is 5.005.02
>The version where they don't work is 5.005, patch 03
>
>Here is a sample of the die routine as it is written:
>
>open (INPUT, "$data_file") || die "Can't open $data_file for
>input - $!\n";
>
>
>>
------------------------------
Date: Fri, 16 Jun 2000 08:59:32 -0400
From: Ted Marz <tfm@sei.cmu.edu>
Subject: Re: Scripts work from shell but not browser
Message-Id: <394A24B4.8FB5121E@sei.cmu.edu>
I suspect that you have got a file permission problem... which has
almost nothing to do with your perl script and everything to do with how
the server is set up.
Many ISPs set up their servers to use SuExec.. this means that when an
cgi script runs in your context (i.e. from a ~username/cgi-bin or from
a dedicated virtual domain) then the script is running as YOU, just as
if you ran it from the shell.
I would bet that on this server, they haven't set up suExec (or its
equivalents), and so the cgi script is running in the same user context
as the web server, which is often nobody:nobody. If this is the case,
the files you are trying to open and read/write would have to either be
owned by nobody and be owner read/write, be in group nobody and be group
read/write, or be world read/writable.
Note: all of this is from a Unix point of view. WindowsNT environments
have similar, but slightly different semantics.
So, check with the server administrator and see if
a) it is apache
b) if so, is it using suExec
-or
c) what username / group the web server is running as
and set the file ownership / group membership and file permissions
accordingly.
Ted Marz
------------------------------
Date: Fri, 16 Jun 2000 13:37:55 +0200
From: Jimmy Lantz <jimmy.lantz@ostas.lu.se>
To: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Sorting a ':' delimeted file by a field value/surname.
Message-Id: <394A1194.85041B01@ostas.lu.se>
Hi, and thanks for the help and pointers you guys sent me.
I've run into the following problems.
- There are people with Identical surnames, by sorting the lines into an
hash don't I just overwrite John Doe with Bill Doe (both with the key
Doe) So in fact I need to sort by both Surname and First name. (that
could also be Identical but less likely, so I ought to use the second
value as ID since that never is the same for 2 persons like a social sec nr.)
-The snippet of code below contains some for me unidentifiable problem
since the file in question contains 47 lines but the
script below only prints out 1 line.
-I have found a module called Sort::ArbBiLex I think I then can sort by
all the letters in the swedish alphabet. Is there someone who has any
experience in working with this module ?
I welcome all pointers to FAQ's/tutorials besides the Perlfaq4.html.
Once Again thank you all for your pointers/tips.
Yours sincerely
Jimmy Lantz
########################
&read_file("$fil"); #reads the file into an array called @lines
$amountoflines = @lines;
print $amountoflines . "\n"; # printing the real amount of lines by
printing the number of lines.
foreach $line (@lines) { $sorted{(split /:/)[3]} = $line; }
print "Testing sorted output below!\n\n";
sort keys %sorted;
foreach $key ( @keys{keys %sorted} ) #
{ print $sorted{$key};}
exit;
####################
Larry Rosler wrote:
>
> In article <394906B9.16C27313@nospam.com>, blah@nospam.com says...
> > Jimmy Lantz wrote:
> > > I'm looking for a way to sort a text file (example below),
> > > it's delimited by : I need to sort lines according to =
> > > surname. I'm working with Macperl, and I'm trying to do all the =
> > > coding my self (not using that many fancy Modules due =
> > > to "portability". Has anyone any Ideas on how to sort the lines =
> > > in alphabetical order, A-Z (to add extra spice I need to sort =
> > > the swedish chars =E5=E4=F6 as well).
>
> Unless those characters are already in the correct sequence relative
> to each other and to the ASCII characters,you cannot do that with the
> default lexicograpic sort. You will need to tailor a sortsub to your
> needs.
>
> > Is there a man on this, I've =
> > > been browsing a lot looking for one. So I have RTFM but I still =
> > > dont see how I can make this work. Could anyone give me any =
> > > pointers on how to go about doing it ?
>
> Start with perlfaq4: "How do I sort an array by (anything)?"
>
> > Also if someone know about =
> > > some tutorials on how to make searches on Datafiles I would =
> > > appreciat a link or two.
> > > ############# Exampleline from file. ##############
> > > KIN231:111111-1111:John:Burnes:jburnes@hotmail.com:555121212:greenway
> > > 21:PO 251:Bournesporth:Scolarship:YES
> > > ^^^^^^
> > > Needs to sort file according to the fifth field in the line.
> ^^^^^
> fourth
>
> > <code>
> > while (<>) { $sorted{(split /:/)[4]}=3D$_ }
> ^
> 3
>
> > foreach $key (sort keys %sorted) { print $sorted{$key} }
> > </code>
>
> ...
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: Thu, 15 Jun 2000 10:11:48 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Ugh
Message-Id: <3948ab7f.69383708@news.itn.is>
On Wed, 14 Jun 2000 10:26:31 GMT, "Dan" <drshickell@bsu.edu>
wrote:
>Anyone know any good ways to transport a perl script to a Unix Machine?
>
>My main Dev machine is Windows. So I write my PERL stuff in notepad etc. I
>need a way to strip newline characters after transfer or a way to easily
>edit PERL on a windows box. Any ideas?
>
Try this useful little script which I call
macorpc2unix:
#!/usr/bin/perl -w -i
while (<>) {s/\r\n*/\n/g;}
continue {print;}
You could also try UltraEdit which allows you to edit
text files in Unix mode, ie with linefeeds only.
------------------------------
Date: Fri, 16 Jun 2000 07:33:11 -0500
From: "Bob Tate" <btate@primary.net>
Subject: Unix database for Perl
Message-Id: <x6p25.4103$bc4.281608@news1.primary.net>
Anyone know a good database for a Unix system that Perl will talk to.
------------------------------
Date: Fri, 16 Jun 2000 12:48:20 GMT
From: VincentMurphy@mediaone.net
Subject: Re: Unix database for Perl
Message-Id: <wkk8fpaj1q.fsf@mediaone.net>
>>>>> "Bob" == Bob Tate <btate@primary.net> writes:
Bob> Anyone know a good database for a Unix system that Perl will talk to.
http://www.perl.com/reference/query.cgi?database
--Vinny
------------------------------
Date: 16 Jun 2000 10:08:17 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: Up-to-date Perl for OS/2?
Message-Id: <8F5575C2Aquuxi@193.82.145.131>
14 Jun 2000: A formal bug report was sent to Seti@Home, because the
following message originated from rootbeer@redcat.com (Tom Phoenix)
was reported as containing signs of intelligence:
>On Wed, 14 Jun 2000, Paul D.Smith wrote:
>
>> Subject: Up-to-date Perl for OS/2?
>>
Depends on what your definition of up-to-date, see below.
>> Anyone know of a source for such a thing? Only binaries required.
>
>Go to CPAN...
>
> http://www.cpan.org/
>
>Select 'binary distributions ("ports")', then 'OS/2'. Does that lead
>you to what you want? Cheers!
>
That is Perl 5.005_03, from 1998
Are you listening, Ilya ? :-)
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
Life is complex, with real and imaginary parts.
------------------------------
Date: Fri, 16 Jun 2000 13:31:46 +0100
From: Steve Webb <S.Webb@ftel.co.uk>
Subject: Validating TCP Address Format
Message-Id: <394A1E32.318B211E@ftel.co.uk>
Does anybody know of any existing routines/regexps to validate the
format of a tcp address which has been entered by a used i.e.
123.123.12.1 is legal 12a,12.a2.34 is not, nor is 300.200.999.1 !!
------------------------------
Date: Fri, 16 Jun 2000 11:41:47 GMT
From: VincentMurphy@mediaone.net
Subject: Re: Validating TCP Address Format
Message-Id: <wkvgz93lag.fsf@mediaone.net>
>>>>> "Steve" == Steve Webb <S.Webb@ftel.co.uk> writes:
Steve> Does anybody know of any existing routines/regexps to validate the
Steve> format of a tcp address which has been entered by a used i.e.
Steve> 123.123.12.1 is legal 12a,12.a2.34 is not, nor is 300.200.999.1 !!
Jeffrey Friedl's book _Mastering Regular Expressions_ has a section
"Matching an IP address" in chapter four.
HTH
--Vinny
------------------------------
Date: Fri, 16 Jun 2000 14:24:37 +0100
From: Steve Webb <S.Webb@ftel.co.uk>
Subject: Re: Validating TCP Address Format
Message-Id: <394A2A95.AAE7C82E@ftel.co.uk>
VincentMurphy@mediaone.net wrote:
>
> >>>>> "Steve" == Steve Webb <S.Webb@ftel.co.uk> writes:
>
> Steve> Does anybody know of any existing routines/regexps to validate the
> Steve> format of a tcp address which has been entered by a used i.e.
> Steve> 123.123.12.1 is legal 12a,12.a2.34 is not, nor is 300.200.999.1 !!
>
> Jeffrey Friedl's book _Mastering Regular Expressions_ has a section
> "Matching an IP address" in chapter four.
>
> HTH
>
> --Vinny
Perfect. I've got the book but didn't notice that section. Thanks
--
--Steve Webb--0121 717 6142--S.Webb@ftel.co.uk--
------------------------------
Date: Fri, 16 Jun 2000 12:27:58 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Where are the error logs?
Message-Id: <Pine.GHP.4.21.0006161211290.8722-100000@hpplus03.cern.ch>
On Fri, 16 Jun 2000, Bart Lateur wrote:
> No, but you could send your error messages to the browser. CGI::Carp
> probably will be a good starting point, and the term "fatalsToBrowser"
> is one I distinctly remember.
>
> But... but... this doesn't send warnings to the browser?
True. But injecting warning messages at random points into what's
(presumably) supposed to be a syntactically valid HTML stream[1]
that's being generated by the script, doesn't exactly make for legible
results on screen.
If you really want this, you could always have the script open its
error output (STDERR) merged into STDOUT, instead of leaving it where
it usually goes (i.e landing up in the server log). But if the error
messages start coming out before the main code has finished the
generation of the CGI headers and has started putting out the content
body (as indeed will often be the case) then all you'd get would be a
server error, due to the invalid CGI headers.
I'd suggest pursuing this topic on c.i.w.a.cgi, there's very
little Perl-language-specific content in this.
[1]Even worse if the script is supposed to be generating JPEG etc.!
------------------------------
Date: Fri, 16 Jun 2000 14:53:18 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Where are the error logs?
Message-Id: <8id7vk$3t26@intranews.dresdnerbank.de>
Hi,
Johnny schrieb in Nachricht ...
>I'm using Perl on an NT IIS server and can't seem to find the error logs
that I
>was hoping would help me debug my perl scripts.
despite the fact that I consider this to be
a little bit off-topic:
You can configure this in IIS (using the MMC).
So just have a look at your config.
Without having a running IIS availiable
a good guess for the default would be a subdirectory.
of %SystemRoot%\system32\LogFiles
Peter Dintelmann
------------------------------
Date: Fri, 16 Jun 2000 10:00:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Where is a Perl/CGI site.
Message-Id: <394af872.352453@news.skynet.be>
Ferk Da Jerk wrote:
>So does any one know where I can find a
>site that teaches you Perl and CGI
http://www.cm.cf.ac.uk/Dave/PERL/
Also check out the links sections at <www.perl.com> (very selective),
the WebMonkey website, and most definitely, Randal Schwartz'
WebTechiques columns at
<http://www.stonehenge.com/merlyn/WebTechniques/>, for incredibly cool
CGI Perl scripts. These mostly do require a Unix-like environment for
the server (e.g. Linux or FreeBSD).
--
Bart.
------------------------------
Date: Fri, 16 Jun 2000 14:38:50 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: why does this code print two spaces?
Message-Id: <8id74g$3sv4@intranews.dresdnerbank.de>
Hi,
mark rowlands schrieb in Nachricht <8ibm6d$jof$1@nnrp1.deja.com>...
>my %ch_pports = map {$_ => 1} @ch_pports;
>my %oh_pports = map {$_ => 1} @oh_pports;
>my @new = grep {!$ch_pports {$_}} @oh_pports;
>my @gone = grep {!$oh_pports {$_}} @ch_pports;
- snip -
>Explain in simple syllables why this is
>happening : it's my second perl program so please be gentle, I am
>trying to learn.
we are trying to help... but I am afraid as long as
we do not know what your @ch_pports etc.
contain (or may contain) we can't tell you.
Inbetween please have a look at exists() and defined()
and your definition of @new/@gone. Maybe you can
help youself.
Best regards,
Peter Dintelmann
------------------------------
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 3388
**************************************