[8373] in Perl-Users-Digest
Perl-Users Digest, Issue: 1990 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 28 02:07:12 1998
Date: Fri, 27 Feb 98 23:00:29 -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, 27 Feb 1998 Volume: 8 Number: 1990
Today's topics:
Re: "PERL" puzzle. (Jeff Yoak)
"require" probs... <tjbtech@rtweb.net>
Re: &ReadParse not working in PerlScript ASP <atijapan@gol.com>
Re: a newbie Q (Craig Berry)
Re: Advice on good CGI Form CONTENT (Craig Berry)
atime? <mamiller@umaryland.edu>
Re: Compiling 5.004_60 with threads <mishra.aditya@emeryworld.com>
Re: date function under NT? (Jeffrey Drumm)
File writting problem <mhanson@arrowweb.com>
Re: Good Perl editors <feng@haas.berkeley.edu>
Re: How do I search a file for a SPECIFIC string? (Greg Bacon)
Re: How do you put a string into a array? <atijapan@gol.com>
Re: how to copy a file from a website (Greg Bacon)
Re: indirect object syntax (O'Shaughnessy Evans)
local $/ (Rick Freeman)
Re: local $/ (Craig Berry)
Re: local $/ <uri@sysarch.com>
Re: many ways but i can not find one <star@sonic.net>
Re: many ways but i can not find one <jdporter@min.net>
Re: Musings on English.pm (Stefaan A. Eeckels)
Passing an argument to a perl script. xxx123_thelion@superlink.net
Re: Perl and the Windows clipboard (Jeff Yoak)
Perl code for parsing Quark XTags? <Tim.Bunce@ig.co.uk>
Re: Perl on Win95 not working (newbie question) and fli <corky@ma.ultranet.com>
Perl4 to Perl5 conversion issues (Maxine G.)
Re: Perl4 to Perl5 conversion issues <palincss@nicom.com>
Re: perlfaq and Perl FAQ's (Greg Bacon)
probably not a Perl limitation <jhi@alpha.hut.fi>
Re: Searching for a string! <star@sonic.net>
testing for variable type <david_ransier@intercept.com>
Re: The Ineffable Tom C. (Robert Melson)
Re: What does this one-liner do? <jdporter@min.net>
Re: Why doesn't this program print out matches? (Greg Bacon)
Re: why no Case statment? <jdporter@min.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 28 Feb 1998 00:25:57 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: "PERL" puzzle.
Message-Id: <6d7lur$9u4@dfw-ixnews9.ix.netcom.com>
[posted and emailed]
"Kevin J. Lin" <kevin@wx3.com> wrote:
>3) What code could I use to fill in the blanks (marked by "????????") If
>you can think of better code for any other section, I'd like to see it.
How about...
>Here's the code:
>###########################################
>#!/usr/bin/perl
[snip]
>CLOSE(my($i)); CLOSE(my($i));
>see you before me
>if ($u eq 'IGNORE'){
> die $i;
>}
>??????????????
>??????????????
if($^O =~ /Win32/) {
use EmotionTest qw(adore);
print &adore($i,$u);
}
# such a hypocrite posting this from Agent. :)
Cheers,
Jeff
-------------------------------
Jeff Yoak jeff@yoak.com
------------------------------
Date: Fri, 27 Feb 1998 18:54:19 -0500
From: Randall Stephenson <tjbtech@rtweb.net>
Subject: "require" probs...
Message-Id: <34F75229.DD8F6872@rtweb.net>
I am using another script as a library for some subs. Obviously, this
requires (no pun intended) the "require" function. Isn't the permission
for a required script 744? Nevertheless, I have tried every permission,
but to no avail. I get this strange message:
[name of required script] does not return true in [name of script] line
[#]
I have never gotten this with any other script, the syntax checks on
both scripts, and I've checked everywhere for an answer, but I cannot
find any. I really hope someone here can help because I am very
desperate. Thank you.
----------------------------
http://www.rtweb.net
------------------------------
Date: 28 Feb 1998 00:42:37 GMT
From: "Bill Wilson" <atijapan@gol.com>
Subject: Re: &ReadParse not working in PerlScript ASP
Message-Id: <01bd43e0$6f5f6520$6117d8cb@atijapan>
Alan,
I think you would get a better responce if you would include the code in
question. Not much to go on from just the information below.
Bill
Alan <alan@globalec.com> wrote in article
<34F66F2E.4524F265@globalec.com>...
> I am using PerlScript in ASP files to create dynamic pages. However, I
> can't get &ReadParse (from cgi-lib.pl) to pickup the info from the form
> that executes the script. There is no error, just nothing shows up.
> Help!
>
> Thanks
> Alan Sturm
>
>
>
------------------------------
Date: 27 Feb 1998 23:06:04 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: a newbie Q
Message-Id: <6d7gss$jpg$1@marina.cinenet.net>
Thommy Lundgren (loo@algonet.se) wrote:
: I've made a script which update my page. Anyway, I've ran the script on 2
: servers. on the first 1 everything is fine, it takes my form-input and write
: it to a file but with my second server it doesn't write my file.. I know
: this a newbie question =)
Can't help with that specifically, but here are some comments:
: #!/usr/local/bin/perl5.003
Why not the latest version? Why no -w ? Why no 'use strict;' ?
: $database = "database.txt";
: read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
: @pairs = split(/&/, $buffer);
: foreach $pair (@pairs)
: {
: ($name, $value) = split(/=/, $pair);
: $value =~ tr/+/ /;
: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
: $value =~ s/~!/ ~!/g;
: $FORM{$name} = $value;}
Why go to all this work (and probably get something wrong) when CGI.pm
exists? The key to good software engineering is plagiarism. :)
: open(FILE,"<$database");
No check on file open? (I'll bet this is where your problem is.)
: @line=<FILE>;
: close FILE;
: open(FILE,">$database");
(or perhaps here, again the open isn't checked.)
: print FILE "$FORM{'rubrik'}<br>$FORM{'medelande'}";
No need to quote inside hash-lookup {}.
: foreach(@line){ print FILE $_; }
: close FILE;
---------------------------------------------------------------------
| 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: 27 Feb 1998 22:17:07 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Advice on good CGI Form CONTENT
Message-Id: <6d7e13$f0t$1@marina.cinenet.net>
Eric Winter (winter@mot.com) wrote:
: Making the form is trivial my question is what are the guidelines
: for writing a good one.
:
: I'm looking for some common sense guidelines when writing the
: standard: send me your name/phone/address CGI form.
[snip]
I think this question would be far more usefully addressed to the CGI
authoring newsgroup.
---------------------------------------------------------------------
| 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, 27 Feb 1998 16:29:51 -0500
From: Matthew Miller <mamiller@umaryland.edu>
Subject: atime?
Message-Id: <Pine.SOL.3.96.980227162044.14364A-100000@umaryland.edu>
Perl on SunOS:
Since I am currently cannot use the stat function to read the access
time of say an individual's tty connection in /devices/pseudo because such
a connection does not exist as a file, how do I aquire this needed
information?
-- Matthew --//
------------------------------
Date: Fri, 27 Feb 1998 15:05:12 -0800
From: "Mishra, Aditya" <mishra.aditya@emeryworld.com>
Subject: Re: Compiling 5.004_60 with threads
Message-Id: <6d7es1$m46@ljcqs003.cnf.com>
You need to join the perl5porters mailing list and post your q's there
the list can be joined by sending
subscribe perl5-porters <uremailid> in the body of mail sent to
perl5-porters@clueserver.org
Adi
------------------------------
Date: Sat, 28 Feb 1998 00:35:26 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: date function under NT?
Message-Id: <34f75708.16503815@news.mmc.org>
On Fri, 27 Feb 1998 19:20:32 GMT, rrowell@shreve.dot.net (Richard Rowell)
wrote:
>Anytime I call this function under NT, the command prompt simply asks
>me to input the new date. What I need is for it to return today's
>date within the program without prompting me for anything. Is their
>possibly another way to do this? I'm developing under NT because my
>RedHat CD hasn't arrived yet, but the script will eventually run under
>Unix(Solaris?) so I hope to find a platform independent solution.
>
>Please forgive the rudimentary question, believe it or not I GREPed
>the manpages, read a FAQ or two, and bought Learning Perl, and
>Programming Perl, but...
>
Perhaps you were looking for a 'date' when you needed 'time', or
gmtime()/localtime(). See the perlfunc man page. Please read it carefully
. . . you'll be glad you did(at least, in just a bit over 21 months).
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: Fri, 27 Feb 1998 16:22:11 -0800
From: Mike <mhanson@arrowweb.com>
Subject: File writting problem
Message-Id: <34F758B3.1521@arrowweb.com>
How do you make it so that if there isn't enough space available on the
server and you try to update a file with new information it will not
delete everything in the file?
------------------------------
Date: Fri, 27 Feb 1998 13:50:57 -0800
From: Patience <feng@haas.berkeley.edu>
To: Zachary Kessin <zkessin@lhr-sys.dhl.com>
Subject: Re: Good Perl editors
Message-Id: <34F73541.4D1695BA@haas.berkeley.edu>
I tried but could not find my .emacs file. Would you tell me where it
might be so I can get the cperl.el working?
Thanks a bunch! : )
--Patience
Zachary Kessin wrote:
> >Someone asked about editors for perl.
>
> I swear by emacs. A lot of people swear at it. You can get an NT
> version which is Decent. If you use emacs with perl use the cperl.el
> that comes with the perl source. Not the perl mode that comes with
> emacs. I at least think the one that comes with perl is better. I
> assume some people like the other one.
>
> As for editors, its is a very personal choice. Try a few.
>
> --Zachary Kessin
------------------------------
Date: 27 Feb 1998 21:47:09 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: miller@bigsky.net
Subject: Re: How do I search a file for a SPECIFIC string?
Message-Id: <6d7c8t$e20$1@info.uah.edu>
[Posted and mailed]
In article <6d6u39$plf$1@nnrp1.dejanews.com>,
miller@bigsky.net writes:
: I would like to search a file for a specific string. Say the word camel, but
: not camels, or big but not bigsky. I can get the file into and array and
: split the array up into fields, but I just can't seem to make it only detect
: what I'm searching for and not other variations. Any HELP out there?
Read the fine perlre manpage and search for `word boundary'.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 28 Feb 1998 00:55:16 GMT
From: "Bill Wilson" <atijapan@gol.com>
Subject: Re: How do you put a string into a array?
Message-Id: <01bd43e2$345d1fb0$6117d8cb@atijapan>
Hi,
Perl5 provides a handy funtion called "qw", or quote word. This
allows you to do things like assign values to arrays without
"" (quotations) and , (commas).
Heres how you use it:
@array = qw(i you he she it them they);
$i=1;
foreach $r (@array) {
print "$i) $r\n";
$i++;
}
Running this gives you:
1) i
2) you
3) he
4) she
5) it
6) them
7) they
Or, if you are particularly fond of typing, you can do it this
way:
@array = ("i", "you", "he", "she", "it", "them", "they");
Cheers,
Bill
Seong Y. Kim <seong@cse.bridgeport.edu> wrote in article
<34F627CA.E1FB2920@cse.bridgeport.edu>...
> Let's say that I have a string "I you he she they me her him
> his them their", and I want the array like this.
>
> $string = "I you he she they me her him his them their";
>
> @array;
> $array [1]= "I";
> $array[2]= "you";
> $array[3]="he";
> .....
> $array[11]="their";
>
> how do you do this?
>
> thanks to ....... ;-)
>
>
>
------------------------------
Date: 27 Feb 1998 22:11:16 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: npaci@bigfoot.com
Subject: Re: how to copy a file from a website
Message-Id: <6d7dm4$e20$4@info.uah.edu>
[Posted and mailed]
In article <34F6CDA7.47A12E90@bigfoot.com>,
Noah Paci <npaci@bigfoot.com> writes:
: Is there an internal way to grab a file off of a web site? I need to
: grab a text file from one site and copy it to my site. I don't think
: the site will let me ftp it off.
% perl -MLWP::Simple -e 'getprint shift' http://www.perl.com/ >file.html
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 27 Feb 1998 21:58:16 GMT
From: shaug@gromit.callamer.com (O'Shaughnessy Evans)
Subject: Re: indirect object syntax
Message-Id: <6d7cto$pmn$1@ha1.rdc1.occa.home.com>
In article <34F6E2F6.708C@plab.ku.dk>,
<tobez@plab.ku.dk>'s keyboard spewed forth thus:
>
>O'Shaughnessy Evans wrote:
>>
>> Just like Gabor mentioned, you need to qualify param(). Since it's
>> not in the main namespace by default, you have to use ``CGI::param''
>> instead. You may find some useful info on this by lookup up the
>> "use" pragma, @EXPORT, @EXPORT_OK, and even the docs for CGI.pm.
>> Also, I think that if you try something like ``use CGI qw(param)''
>> instead of simply ``use CGI'', you won't have to qualify that
>> function.
>
> That's VERY wrong! param $cgi 'bar' is an alternative syntax for
> calling methods of objects. Methods do not need to be exported
> into caller's namespace.
Ah, I think I understand now. I was thinking of calling param() as a
module function, and didn't remember that there was a different calling
syntax for object methods. So to summarize, and make sure that I and
the original poster have things clear now, there are really several ways
to call param().
There's the functional syntax, as shown below:
use CGI qw(param);
$cgi = new CGI;
$foo = param($cgi, 'bar');
or
use CGI;
$cgi = new CGI;
$foo = CGI::param($cgi, 'bar');
And then there's the object syntax, as shown here:
use CGI;
$cgi = new CGI;
$foo = param $cgi 'bar'; # note lack of parens and initial comma
or
use CGI;
$cgi = new CGI;
$foo = $cgi->param('bar');
or even
use CGI;
$foo = CGI::param('bar');
I'm not sure exactly why this last one works just as well as the rest.
I assume that CGI is doing us a couple of favors behind the scenes,
probably by doing the same things that CGI::new() does without resulting
in the creation of a new object.
Regards.
--
- O'Shaughnessy Evans
- http://www.callamerica.net/shaug/
------------------------------
Date: Fri, 27 Feb 1998 21:39:31 GMT
From: rick@marinweb.com (Rick Freeman)
Subject: local $/
Message-Id: <34f93172.16485810@nntp2.ba.best.com>
Is this safe within a subroutine:
local $/;
undef $/;
Will it do what I want, which is to undefine the input record
separator, but only for this sub?
Rick Freeman
Editor, MarinWeb
M a r i n W e b
Marin's Home on the World Wide Web
http://www.marinweb.com/
98 Main Street #453
Tiburon CA 94920
415-458-3201
------------------------------
Date: 27 Feb 1998 23:15:28 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: local $/
Message-Id: <6d7heg$jpg$2@marina.cinenet.net>
Rick Freeman (rick@marinweb.com) wrote:
: Is this safe within a subroutine:
:
: local $/;
: undef $/;
:
: Will it do what I want, which is to undefine the input record
: separator, but only for this sub?
$/ will be undefined from the point these lines appear to the end of the
block they're in (including the outermost block of a sub as one case), and
also in any subs called from this region -- which can cause problems. The
safest idiom is
sub your_sub
{
...
{
local $/;
undef $/;
open FILE, "<file.txt" or die "$!";
$fileContents = <FILE>;
close FILE;
}
...
}
That way you limit the 'danger region' to the inside of the inner block,
where you can carefully refrain from calling other subs that might depend
on $/.
Obviously, if your sub doesn't call any other subs, this whole added
layer of caution isn't needed.
---------------------------------------------------------------------
| 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: 27 Feb 1998 18:39:27 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: local $/
Message-Id: <x767m01uts.fsf@sysarch.com>
rick@marinweb.com (Rick Freeman) writes:
> Is this safe within a subroutine:
>
> local $/;
> undef $/;
>
> Will it do what I want, which is to undefine the input record
> separator, but only for this sub?
yes and the previous value of $/ will return when you exit the sub or
scope of the local.
but beware, the change is global. if you call another routine which
reads another file before you exit this scope, the value of $/ will still be
undef. i ran into this when i used the filehandle module and called
$handle->input_record_separator( undef );
and thinking that set it for that file only!! was i wrong!! this is not
documented well since most of the other filehandle attributes are file
specific. some (including me) think this is a bug. i once reported it
and they sort of agreed but nothing has changed AFAIK.
HTH,
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: Fri, 27 Feb 1998 14:33:57 -0800
From: ~arthur <star@sonic.net>
Subject: Re: many ways but i can not find one
Message-Id: <34F73F55.2807@sonic.net>
Thanks Myles Barrett Williams. I just remind myself to breathe deep! Try
it! Take a deep breath feels good. HUH! Everyone who reads this feel
good!
~arthur
>
> (This is what all those rude replies were trying to tell you. Don't
> mind those people, they're just socially repulsive by nature.)
>
> --
> mwilliam@ | "Who'll join my tribe?" -- Jack, _Lord of the Flies_
> cs.utk.edu | I successfully filter out ALL junk E-mail.
------------------------------
Date: Fri, 27 Feb 1998 15:52:45 -0500
From: John Porter <jdporter@min.net>
Subject: Re: many ways but i can not find one
Message-Id: <34F7279D.6B3@min.net>
Uri Guttman wrote:
>
> also try
>
> printf "%${i}\n", $x
>
> which will account for the length of $x in the indent.
For those who may have missed it, Uri's answer has a tiny
typo -- it's missing a 's' in the format.
printf "%${i}s\n", $x
John Porter
------------------------------
Date: 27 Feb 1998 23:25:40 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A. Eeckels)
Subject: Re: Musings on English.pm
Message-Id: <6d7i1k$8pq$1@justus.ecc.lu>
In article <6d6st4$s7o$1@mathserv.mps.ohio-state.edu>,
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> <joseph@5sigma.com>],
> who wrote in article <34F68743.43AB660F@5sigma.com>:
>> Wow, I can't believe that this actually works:
>>
>> $_ = "testing one two three";
>> /one/;
>> eval q{
>> print "before: $`\n";
>> print "match: $&\n";
>> print "after: $'\n";
>> };
>
> G:\papers>perl
> $_ = "testing one two three";
> /one/;
> eval q{
> print "before: $`\n";
> print "match: $&\n";
> print "after: $'\n";
> };
> ^Z
> before:
> match:
> after:
Ahem:
justus~[133] perl
$_ = "testing one two three";
/one/;
eval q{
print "before: $`\n";
print "match: $&\n";
print "after: $'\n";
};
^D
before: testing
match: one
after: two three
justus~[134]
So it does work (perl5.004_3).
Stefaan
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
"Don't worry about people stealing your ideas. If your ideas
are any good, you'll have to ram them down people's throats."
-- Howard Aiken
------------------------------
Date: Fri, 27 Feb 1998 17:31:14 -0500
From: xxx123_thelion@superlink.net
Subject: Passing an argument to a perl script.
Message-Id: <6d7eqt$hie$1@earth.superlink.net>
I'm trying to pass an argument (a string) to a perl script and
manipulate this string within the script. How do I get this string into
the script and for example print it out from inside the script. i.e.
./thisperlscript thisstring
I'm executing this script from the command line.
Remove "xxx123_" to send a response via email.
------------------------------
Date: Fri, 27 Feb 1998 22:59:59 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: Perl and the Windows clipboard
Message-Id: <6d7gtj$b1p@sjx-ixn4.ix.netcom.com>
[posted and emailed]
ben_j@usa.net (Ben Jones) wrote:
>Hi,
>I'm new to Perl, and I've just written my first few scripts which do
>various bits of text processing.
>What I'd like to do is incorporate these Perl utilities into my text
>editor (TextPad). I can get TextPad to copy selected text to the
>clipboard before it runs a Perl script. So the question is this:
>Is there a way of using the windows clipboard as the input file for a
>Perl script?
I haven't used it, but there is a module with the standard Win32 port
called Win32::Clipboard that probably does what you need.
Cheers,
Jeff
-------------------------------
Jeff Yoak jeff@yoak.com
------------------------------
Date: Fri, 27 Feb 1998 18:50:57 GMT
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Perl code for parsing Quark XTags?
Message-Id: <Ep1wCx.Ats@ig.co.uk>
Does anyone have any existing perl code to parse Quark XTags files?
(I'll summarise any replies that come direct to me.)
Thanks.
Tim.
------------------------------
Date: Fri, 27 Feb 1998 18:57:37 -0500
From: Bob Trieger <corky@ma.ultranet.com>
To: Barry Phillips <sb67@dial.pipex.com>
Subject: Re: Perl on Win95 not working (newbie question) and flip /'s problem
Message-Id: <34F752F1.5F74@ma.ultranet.com>
Barry Phillips wrote:
>
> HELP.
> I'm quite new to perl and have a problem. I've installed Gurusamys's Win32
> port of perl onto Windows 95.
>
> However whenever I run any 'module' rouintes I get:-
> E.G.
>
> ($name,$path,$suffix) = fileparse("lib/File/Basename.pm","\.pm");
> undefined subroutine &main::fileparse
>
You have to tell it which module you are using.
ie.
use File::Basename;
HTH
Bob Trieger
corky@ultranet.com
------------------------------
Date: Fri, 27 Feb 98 22:26:20 GMT
From: *nospam*mg*nospam*@*nospam*pcg*nospam.net (Maxine G.)
Subject: Perl4 to Perl5 conversion issues
Message-Id: <6d7eqr$sfa$1@usenet49.supernews.com>
I will soon be migrating an application from a perl4 system to a perl5 system.
Is there a summary of conversion issues somewhere that I could look at? The
only thing I've heard about is having to put a "\" before a "@".
Please reply by e-mail.
Tia!
*********************************************************
return address changed to prevent spamming
Remove "NOSPAM" in the return address
Maxine Gerber
PCG Systems
*********************************************************
------------------------------
Date: Fri, 27 Feb 1998 17:46:06 -0800
From: Steve Palincsar <palincss@nicom.com>
Subject: Re: Perl4 to Perl5 conversion issues
Message-Id: <34F76C5E.3B31@nicom.com>
You know, I seriously considered replying by mail, but you've
just made it too damned hard to figure out what your address
actually is.
Maxine G. wrote:
>
> I will soon be migrating an application from a perl4 system to a perl5 system.
> Is there a summary of conversion issues somewhere that I could look at? The
> only thing I've heard about is having to put a "\" before a "@".
>
> Please reply by e-mail.
>
> Tia!
>
>
> *********************************************************
> return address changed to prevent spamming
> Remove "NOSPAM" in the return address
> Maxine Gerber
> PCG Systems
> *********************************************************
------------------------------
Date: 27 Feb 1998 22:09:05 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: kent@darwin.eeb.uconn.edu (Kent E. Holsinger)
Subject: Re: perlfaq and Perl FAQ's
Message-Id: <6d7di1$e20$3@info.uah.edu>
[Posted and mailed]
In article <x7u39khj9w.fsf@darwin.eeb.uconn.edu>,
kent@darwin.eeb.uconn.edu (Kent E. Holsinger) writes:
: In the spirit of giving something back to a group that's been a big
: help to me and of making it easier for everyone to search rapidly
: through the FAQ's I offer perlfaq, which is derived from a script
: originally posted a couple of months ago by Andrew Johnson.
Cool! Here are some changes I find helpful (although it would probably
be nice to roll this into perldoc):
diff -u perlfaq.orig perlfaq
--- perlfaq.orig Fri Feb 27 16:09:55 1998
+++ perlfaq Fri Feb 27 16:10:47 1998
@@ -56,7 +56,7 @@
my $faqdir = $Config{privlib} . '/pod';
my $pager = $Config{pager} if $opt_l && defined($Config{pager});
-my $pattern=$ARGV[0];
+my $pattern= shift || die Usage();
opendir(FAQDIR,$faqdir) || die "can't open $faqdir: $!";
my @faqs=grep /faq/,readdir FAQDIR;
@@ -124,7 +124,7 @@
foreach my $faq (@faqs) {
open(FAQ,"$faqdir/$faq") or die "can't open $faq: $!";
while (<FAQ>) {
- print $fh "$faq:$_" if /^=head.*?$pattern/;
+ print $fh "$faq:$_" if /^=head.*?$pattern/i;
}
close FAQ;
@@ -139,8 +139,8 @@
foreach my $faq (@faqs) {
open(FAQ,"$faqdir/$faq") or die "can't open $faq: $!";
while (<FAQ>) {
- $n=1 if /^=head.*?$pattern/;
- $n=0 if /^=head(?!.*?$pattern)/;
+ $n=1 if /^=head.*?$pattern/i;
+ $n=0 if /^=head(?!.*?$pattern)/i;
print $fh $_ if $n;
}
close FAQ;
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 28 Feb 1998 01:44:15 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: probably not a Perl limitation
Message-Id: <oeek9aglik0.fsf@alpha.hut.fi>
li_sen@yahoo.com writes:
>
> What's up with Perl? I ran some tests and found that Perl hits a limit of
> about 62 files before it chokes! That is, I open files until I can't anymore
> (The code is below)and the script stops at 61 files. Shouldn't this be a
> system limitation and not a Perl limitation? I'm running Solaris 2.6 with
> 128MB of RAM.
How do you know that this is a Perl limitation? I very strongly
suspect you are seeing a 64 files per user limit. IIRC that happens
to be the Solaris default. Say 'limit' or 'ulimit -a' in your shell
and you'll see.
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Fri, 27 Feb 1998 14:43:50 -0800
From: ~arthur <star@sonic.net>
Subject: Re: Searching for a string!
Message-Id: <34F741A5.41D1@sonic.net>
Keith in the string put an anchor \b
/fred\b/ matches fred and not fredrick
i got that from O`Riellys book "Learning Perl"
~arthur
------------------------------
Date: Fri, 27 Feb 1998 15:47:02 -0800
From: "David M. Ransier" <david_ransier@intercept.com>
Subject: testing for variable type
Message-Id: <6d7jcg$4gp$1@usenet1.interramp.com>
Is there a way to test for variable type? I've looked through several books
and haven't found a reference, except that Perl will change the type of
variable depending upon the operation.
Here is my problem, I am writing a subroutine to convert units of numbers
(i.e., MM to INches) in an array. My array may contain strings and I only
want to convert the number elements.
@array = qw ( 1 2 3 fred mary 34 ted 100 );
@new_array = convert_MM_2_IN(@array);
@new_array should have ( .039 .078 .118 fred mary 1.338 ted 3.937 )
Is there a way to walk an array (Yes, I can do that) and test each element
to see if it is a string or number?
Thanks,
David R
-----------------------------------
David M. Ransier
Senior Consultant
Intercept Technology Inc.
David_Ransier@Intercept.com
503-692-0111 www.intercept.com
503-691-9535 - Fax
404-352-0111 - ITI Headquarters
------------------------------
Date: 28 Feb 1998 00:17:31 GMT
From: bmelson@swbell.net (Robert Melson)
Subject: Re: The Ineffable Tom C.
Message-Id: <6d7l2r$mq8$1@nnrp1>
Well, mayble he *is* effable, rather than the reverse ... probably a poor
choice of words on my part when originally kicking off this thread.
One thing strikes me in all this discussion, quite apart from the Tom-bashing
and tooth gnashing. Seems to me that a lot of what we have beeh hashing
back and forth has its roots in the PoB culture, which -- rightly or wrongly --
appears to discourage the reading of documentation. Indeed, from what I've
seen, the PoBs run headlong at a problem, mousing here, then there, following
trails into the jungle of pull-downs and pop-ups, tweaking this'n'that, until
they've either solved the problem or have become so lost in this maze of
their own creation they throw up their hands in dispair. The thought process
so encouraged seems to be that if it's not in a help screen or immediately
obvious on a configuration panel it's just not documented. This isn't
intended to be a rant about the Evil Empire, nor an attempt to excuse the
behavior being condemned (excused). I think what we're seeing and discussing
is an inevitable consequence of this racket's success and spread. Like it or
not, we'll probably have to get used to it.
What I find objectionable in all this is the almost total lack of civility on
the part of some participants. Some of those answering queries are, whether
intentionally or not, terse to the point of rudeness. At the same time, some
of those posting queries appear to have chips on their shoulders. Frankly, I
don't there's justification -- or room -- for either attitude.
Having delivered myself of rather more than my $0.02 worth, I will now return
to lurking.
--
----------------------------------------------------------------------------
Bob Melson The right to be heard does not include
Rio Grande Microsolutions the right to be taken seriously
El Paso, TX bmelson@swbell.net Hubert Humphrey
----------------------------------------------------------------------------
------------------------------
Date: Fri, 27 Feb 1998 15:23:28 -0500
From: John Porter <jdporter@min.net>
Subject: Re: What does this one-liner do?
Message-Id: <34F720C0.2104@min.net>
Mark Conty wrote:
>
> Yeah, but if it's supposed to reflect the expression to the right of
> the assignment, and that expression renders a scalar value, then the
> assignment should be of that [scalar] value, not of some subordinate
> expression that just happens to be a list. In the case of the example
> from the man page, $x should be neither 2 nor 3, but 1 !
>
> That, or the man page should be changed to read something like:
>
> Array assignment in a scalar context returns the number of
> elements produced by the _scalar_ evaluation of the
> _rightmost_* expression of the assignment: [emphasis added]
>
> (* ... or should that read _innermost_?)
I'm not sure what your point is, but as it currently stands, the
manpage accurately describes the implementation.
Context, as Greg said, is "fun". Array assignment in a scalar
context is not the same as an array expression in a scalar context.
John Porter
------------------------------
Date: 27 Feb 1998 21:59:39 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: David Lee Lambert <lamber45@EGR.msu.edu>
Subject: Re: Why doesn't this program print out matches?
Message-Id: <6d7d0b$e20$2@info.uah.edu>
[Posted and mailed]
In article <Pine.GSO.3.96.980227150505.21638A-100000@area51>,
David Lee Lambert <lamber45@EGR.msu.edu> writes:
: I'm trying to write a perl program (to be run from with procmail, perhaps
: with perl -e) which scans an E-mail message and tries to find out everyone
: who is responsible for it.
#! /usr/bin/perl -w
use strict;
use Mail::Internet;
my $msg = new Mail::Internet \*STDIN, Modify => 0;
my $head = $msg->head;
for ( qw( from errors-to reply-to x-sender sender ) ) {
print $head->get($_);
}
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Fri, 27 Feb 1998 15:39:32 -0500
From: John Porter <jdporter@min.net>
Subject: Re: why no Case statment?
Message-Id: <34F72484.67D6@min.net>
Tor Iver Wilhelmsen wrote:
>
> On Wed, 25 Feb 1998 15:40:09 -0500, John Porter <jdporter@min.net>
> uttered:
>
> >$d2{ $x cmp $y }->();
>
> Or &$d2{ $x cmp $y};
Um, wrong.
Try it. (I bet you didn't.) I get a fatal compile error.
You have to use braces:
&{ $d{$z} };
Now, given these two ways of doing it:
$d{$z}->();
and
&{ $d{$z} };
can you tell me what the difference is, if any?
John Porter
------------------------------
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 1990
**************************************