[6821] in Perl-Users-Digest
Perl-Users Digest, Issue: 446 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 7 16:17:36 1997
Date: Wed, 7 May 97 13:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 7 May 1997 Volume: 8 Number: 446
Today's topics:
Re: > 2GB "file too large", AIX 4.2, perl 5.001, not "u (peter hakanson)
Re: > 2GB "file too large", AIX 4.2, perl 5.001, not "u (Phil Pishioneri)
a href in =>values? (Patrick O'Leary)
Re: Built in Perl func to expand env vars??? <nyxcu@ny.ubs.com>
canned replies <gkurian@iie.org>
Re: canned replies (Nathan V. Patwardhan)
canned reply?? <gkurian@iie.org>
Re: canned reply?? <rra@stanford.edu>
Re: clever coding required (Martin Cohen)
Re: DANGER !! Search patters (Chipmunk)
double expansion lrl@psu.edu
Re: double expansion (M.J.T. Guy)
Re: double expansion <anirvan@crl.com>
Re: double expansion <rra@stanford.edu>
FTP support in perl <fritz@fuse.net>
join and references (Christian E. Hopps)
Re: join and references <rra@stanford.edu>
No dbm on this machine <brian.diggle@bl.uk>
Re: Notice to antispammers (Cameron Hayne)
Re: Perl and fixing dynamic URLS (Kyzer)
Re: Perl and fixing dynamic URLS <aas@bergen.sn.no>
PERL cross reference generator <johnc@interactive.ibm.com>
Possible inclusion into FAQ <vipul@xcaliber.com>
Re: Problem with uppercase reg exp mel@west.net
Re: program for perl? (Bill Kannawin)
Re: replacing escape characters in a text file. johnsonn@masirv.com
Re: REQ: Perl obfuscator <sjn@pvv.ntnu.no>
SDBM on Solaris, and NT (Dave Newman)
split problem <vvbereza@russiamail.com>
Re: split problem <rra@stanford.edu>
Splitting terminal window in 2 with perl (Rodney Mach)
Strange effect (Softing)
Re: Strange effect <stephen+usenet@farrell.org>
Re: Strange effect (M.J.T. Guy)
Re: TIEARRAY Q (M.J.T. Guy)
What does Familiar Mean? [Intel v. Schwartz] (Jeffrey Kegler)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 May 1997 15:43:00 GMT
From: peter@cyklop.volvo.se (peter hakanson)
Subject: Re: > 2GB "file too large", AIX 4.2, perl 5.001, not "ulimit"
Message-Id: <5kq7u4$h4e@nike.volvo.se>
Looks like a clear case for migrating to DEC-unix or anything
else that runs on 64 bits machines. (aka "full grown box")
(we had a discussion in this group some time ago where many
people stated "noone will ever NEED more then 32 bits machines)
Peter h
Bob Shair (rmshair@uiuc edu) wrote:
: "Geoff Mottram" <minaret@sprynet.com> writes:
: >Two gigabytes is the typical file size limit on a UNIX system. That's
: >because it's the largest number you can hold in a signed 32 bit integer.
: >Even if AIX can create larger files, Perl may not be able to manipulate
: >them properly. Are you sure you can't break the files up a bit?
: Would that we could! This client is growing so fast it's almost killed them!
: --
: Bob Shair Open Systems Consultant
: 1018 W. Springfield Avenue rmshair@uiuc.edu
: Champaign, IL 61821 217/356-2684
: < Not employed by or representing the University of Illinois >
--
--
<peter.devnull@cyklop.volvo.se> (remove ".devnull" before use!)
Peter Hakanson VolvoData Dep 2580 phone +46 31 66 74 27
------------------------------
Date: 7 May 1997 18:15:41 GMT
From: pgp@tc.cornell.edu (Phil Pishioneri)
To: pgp, rmshair@uiuc.edu
Subject: Re: > 2GB "file too large", AIX 4.2, perl 5.001, not "ulimit"
Message-Id: <5kqgsd$h1c@news.tc.cornell.edu>
[posted and emailed]
[I can't find the original article anymore, so replying to this]
In article <5ko44g$qie@vixen.cso.uiuc.edu>, rmshair@uiuc.edu (Bob Shair) writes:
|> "Geoff Mottram" <minaret@sprynet.com> writes:
|>
|> >Two gigabytes is the typical file size limit on a UNIX system. That's
|> >because it's the largest number you can hold in a signed 32 bit integer.
|> >Even if AIX can create larger files, Perl may not be able to manipulate
|> >them properly. Are you sure you can't break the files up a bit?
|>
|> Would that we could! This client is growing so fast it's almost killed them!
Older AIX binaries cannot make use of large files, the application must
be recompiled (and perhaps modified) first.
It is possible to recompile a program with a defined constant which
causes the old filesystem related calls to be remapped to their 64 bit
counterparts, although this may not work in all cases.
The online AIX documentation (InfoExplorer) has an article about all of
this; search for the title:
Writing Programs Which Access Large Files
-Phil Cornell Theory Center
------------------------------
Date: 7 May 1997 17:41:59 GMT
From: barno@hoi.corp.sun.com (Patrick O'Leary)
Subject: a href in =>values?
Message-Id: <5kqet7$44t@jethro.Corp.Sun.COM>
I'm using checkbox_group to create user-selectable boxes that have
lables and(hopefully!)URL address..
The problem is, it won't work for me. I've looked at the documentation
and it doesn't say I can't...so, here's what I'm looking for:
$query->checkbox_group(-name=>'foo',
-values=>['a href here, Name of href here']..
so something like <a href=/spmis/foo.html>Foo</a>
Any ideas?
TIA,
Patrick O'Leary
e-mail address: patrick.oleary@Corp.Sun.COM
------------------------------
Date: Wed, 30 Apr 1997 19:20:15 -0400
From: Glen Culbertson <nyxcu@ny.ubs.com>
Subject: Re: Built in Perl func to expand env vars???
Message-Id: <3367D3AF.5648FDB4@ny.ubs.com>
Look up %ENV, 'Env module', and/or 'environment variables' in your
index. If the answer is not there, ask again with more clarity about
your specific problem--I can't tell from your example if your problem is
simple or tricky!
Eric Kischell wrote:
>
> Hello,
>
> I am currently learning Perl from the Camel book.
> Is there any built-in Perl functionality(non system calls) to expand
> environmental variables?
>
> ex parsed from file.)
> CT header file: $(PATIENT_DIR)/ct/hdr.I20886_3.001
>
> $(PATIENT_DIR) would be expanded to what it is set to in the user's
> current environment.
>
> thx in adv
> e.-
------------------------------
Date: Wed, 07 May 1997 11:28:07 -0400
From: George Kurian <gkurian@iie.org>
Subject: canned replies
Message-Id: <33709F44.4E81@iie.org>
Does anyone know where I can get a perl script that generates canned
replies?
- Thanks, George
------------------------------
Date: 7 May 1997 17:26:39 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: canned replies
Message-Id: <5kqe0f$q3d@fridge-nf0.shore.net>
George Kurian (gkurian@iie.org) wrote:
: Does anyone know where I can get a perl script that generates canned
: replies?
perl -e 'print "?> ";chop($val=<STDIN>); print "Thanks for your response.\n";'
What kind of canned response were you looking for?
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Wed, 07 May 1997 11:33:10 -0400
From: George Kurian <gkurian@iie.org>
Subject: canned reply??
Message-Id: <3370A0B6.67C4@iie.org>
Does anyone know where I can get a perl script that generates canned
replies?
- Thanks, George
------------------------------
Date: 07 May 1997 12:32:45 -0700
From: Russ Allbery <rra@stanford.edu>
To: gkurian@iie.org
Subject: Re: canned reply??
Message-Id: <m3ohanm61u.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
George Kurian <gkurian@iie.org> writes:
> Does anyone know where I can get a perl script that generates canned
> replies?
<URL:ftp://ftp.perl.com/pub/perl/tchrist/modules/Mail_AutoFAQ-1.001.tgz>
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: 7 May 97 10:07:34 GMT
From: mcohen@arl.mil (Martin Cohen)
Subject: Re: clever coding required
Message-Id: <33705466.A93@arl.mil>
Andrew Johnson wrote:
-
- alex wrote:
- >
- > Hi everyone,
- >
- > I've spend hours upon hours trying to cleverly deal with data of the
form
- > a field | some more stuff | another field | field4 | hello
mum
- > (dumped from a rdbms)
- >
- > Field are separated by the pipe char | Each field may have
trailing and
- > leading whitespace.
[ deleted ]
Any reason not to use /\b\s*|\s*\b/ as the regular expression for the
split? Then you would only have to trim the front of the first field
and the back of the last. I did *not* test this.
--
Martin Cohen - AMSAA-North - Custom House Rm 800 Phila PA 19106-2976
------------------------------
Date: 7 May 1997 17:40:12 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: DANGER !! Search patters
Message-Id: <5kqeps$1ob$1@dartvax.dartmouth.edu>
In article <336F7FCE.167E@iil.intel.com>
Shlomo Anglister <shlomoa@iil.intel.com> writes:
> Avoid search patters with $'rs and and + signes they tend to confuse
> perl.
> for example try to extract a file name containing +#$@% from a full
> path.
>
> /usr/include/#TEST#++/foo++##@@$$/test%%$##$@!^.#$%
>
> This is a good excercise, I think
On the contrary, they don't confuse Perl at all. Rather, they confuse
the programmer. In other words, you.
$ and + are metacharacters with special meanings in regular
expressions.
Chipmunk
------------------------------
Date: 7 May 1997 18:58:28 GMT
From: lrl@psu.edu
Subject: double expansion
Message-Id: <5kqjck$15s4@r02n01.cac.psu.edu>
I want to do something I think of as double expansion or double
interpretation. For example, in this code snippet:
$a = "hello";
$b = "a";
print ${ $b };
I want the print to print out "hello" - so first the $b in the brackets
would be evaluated to "a", then "print $a" would be done, resulting in
"hello" being printed. Is there a way to do this sort of thing in perl?
------------------------------
Date: 7 May 1997 19:27:42 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: double expansion
Message-Id: <5kql3e$be6@lyra.csx.cam.ac.uk>
In article <5kqjck$15s4@r02n01.cac.psu.edu>, <lrl@psu.edu> wrote:
>I want to do something I think of as double expansion or double
>interpretation. For example, in this code snippet:
>
>$a = "hello";
>$b = "a";
>print ${ $b };
>
>I want the print to print out "hello" - so first the $b in the brackets
>would be evaluated to "a", then "print $a" would be done, resulting in
>"hello" being printed. Is there a way to do this sort of thing in perl?
Well, I just tried the above, and it seemed to work, so I suppose there
is a way in Perl 5. Perl 4 is another story.
See "Symbolic references" in the perlref man page.
Mike Guy
------------------------------
Date: 7 May 1997 19:32:13 GMT
From: Anirvan Chatterjee <anirvan@crl.com>
Subject: Re: double expansion
Message-Id: <5kqlbt$8v7$1@nnrp1.crl.com>
-----BEGIN PGP SIGNED MESSAGE-----
lrl@psu.edu wrote:
: I want the print to print out "hello" - so first the $b in the brackets
: would be evaluated to "a", then "print $a" would be done, resulting in
: "hello" being printed. Is there a way to do this sort of thing in perl?
Yes. Your code snippet works fine in perl5.
_______________________________________________________________
Anirvan Chatterjee . anirvan@crl.com . <URL:http://www.mx.org/>
PGP 0x93C5C165 . finger for PGP/geek . encrypted mail preferred
http://www.mx.org/bookfinder/ : online book comparison shopping
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBM3DYYWTQ0LuTxcFlAQHuawP/WFCTPfsvIsz4XUsGbg5kWXOmNlqiFDPU
/rNPy95fl3i6n/o4NJQD2Ll2PHEQsO1EnPSwIw9vPOFmro0z6TylYVKRwer+Jj6N
/jsD5IGWc88uMbqB2q20CeiXfOOEXKsXd2TwiyauusnMoFj5vS/HUEiDvH02TCVD
VyGPfiPWiBM=
=uiLH
-----END PGP SIGNATURE-----
------------------------------
Date: 07 May 1997 12:39:50 -0700
From: Russ Allbery <rra@stanford.edu>
To: lrl@psu.edu
Subject: Re: double expansion
Message-Id: <m3g1vzm5q1.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
lrl <lrl@psu.edu> writes:
> I want to do something I think of as double expansion or double
> interpretation. For example, in this code snippet:
> $a = "hello";
> $b = "a";
> print ${ $b };
> I want the print to print out "hello" - so first the $b in the brackets
> would be evaluated to "a", then "print $a" would be done, resulting in
> "hello" being printed. Is there a way to do this sort of thing in perl?
What's wrong with the way you did it? The above code prints out "hello".
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: Tue, 06 May 1997 22:01:49 -0400
From: Fritz <fritz@fuse.net>
Subject: FTP support in perl
Message-Id: <336FE28D.7B73@fuse.net>
In a shell script I can do something like the following to FTP multiple
files from a machine:
ftp myhost << !
userid
prompt
bin
get file01
get file02
!
Can I do something similar form Perl, or do I need to get into sockets?
Certainly I could call a shell script to do this, but it would be nicer
to do it all from within Perl.
Thanks in advance.
fritz@fuse.net
------------------------------
Date: 07 May 1997 13:30:54 -0400
From: chopps@merit.edu (Christian E. Hopps)
Subject: join and references
Message-Id: <sy3u3kfjik1.fsf@life.merit.edu>
Hi,
I'm trying to join a reference with some other text. It appears
that the data being referenced goes away when the only reference
to it is within the joined object.
Can someone explain why the following program does not do what is
expected? It looks like a bug to me however I am willing to
believe that I have misunderstood (or failed to grasp) something.
$bar = "1 2 3";
@list;
sub one
{
local ( $foo );
$foo = join("$;", "joe", [ split(/\s+,/, $bar) ]);
push (@list, $foo);
}
sub two
{
local ($foo, $ent);
local ($name, $arrayref);
for $foo (@list) {
( $name, $arrayref ) = split ("$;", $foo);
for $ent (@$arrayref) {
print "$ent\n";
}
}
}
&one;
&two;
------------------------------
Date: 07 May 1997 12:36:26 -0700
From: Russ Allbery <rra@stanford.edu>
To: chopps@merit.edu (Christian E. Hopps)
Subject: Re: join and references
Message-Id: <m3k9lbm5vp.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Christian E Hopps <chopps@merit.edu> writes:
> I'm trying to join a reference with some other text. It appears that
> the data being referenced goes away when the only reference to it is
> within the joined object.
> sub one
> {
> local ( $foo );
> $foo = join("$;", "joe", [ split(/\s+,/, $bar) ]);
> push (@list, $foo);
> }
Yes, you're coercing your reference to a string. When you do that, it
ceases to be a reference, loses all of its magic, and becomes simply a
string, since there is no way of converting a string back to a reference.
Due to that, the reference count on whatever object it refers to is
decreased, and since in this case it's the only thing referring to that
anonymous array, that anonymous array goes away.
What you're trying to do isn't going to work the way you're trying to do
it. References are too fragile to stuff into strings like that.
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: Wed, 07 May 1997 17:51:29 -0700
From: Brian Diggle <brian.diggle@bl.uk>
Subject: No dbm on this machine
Message-Id: <33712391.55A1@bl.uk>
I've intalled perl 5.003 on my DEC Alpha, running DEC OSF 4. I'm
getting the error 'No dbm on this machine' when using dbmopen. Is
there an option I need to specify on installation of PERL to get this
working? If not, any ideas?
Brian Diggle,
British Library.
------------------------------
Date: Wed, 07 May 1997 13:51:28 -0400
From: hayne@crim.ca (Cameron Hayne)
Subject: Re: Notice to antispammers
Message-Id: <hayne-ya023480000705971351280001@192.26.210.2>
In article <xnyn2qghegh.fsf@placebo.hr.lucent.com>, rsi@lucent.com wrote:
>Be that as it may, that's my business and not yours. My purpose is to
>foil spam mail... and I'll do whatever it takes. If it means that
>people compelled to mail as well as post their replies find it
>bothersome, I'm sorry but that's just the way it is.
"Compelled to" is the crux of the matter. This vast discussion
really centres around what is the nature of Usenet discussion groups.
I am among those who feel that:
1) It is usually a courtesy to send an email copy when you respond
to someone's article. I.e. most people appreciate this.
Those people who don't want such a courtesy copy should say so
in their signature and not saddle me with the need to deal specially
with their address or else deal with bounced mail, etc.
2) There are often situations where email is the appropriate medium
instead of a newsgroup posting and I shouldn't have to figure out
what to do in order to send you email.
3) You don't (i.e. shouldn't) have the right to say something in a public
forum and then not be accessible for discussion of what you said.
--
Cameron Hayne (hayne@crim.ca)
Centre de recherche informatique de Montreal
------------------------------
Date: 7 May 1997 16:10:22 GMT
From: junkmail@sysc.abdn.ac.uk (Kyzer)
Subject: Re: Perl and fixing dynamic URLS
Message-Id: <5kq9he$du2@info.abdn.ac.uk>
When Tom Phoenix met comp.lang.perl.misc....:
: On Thu, 1 May 1997 TempStephenByrne@extonpo.bentley.com wrote:
: > I have a file that I "sucked" down that is called the following:
"sucked"? Is that one of those adult-only things?
: > "./SELECT_cgi/owa/SOLS.VaultDetail?Application=Engineering+Links%3CSUP%3ET
: > M%3C/SUP>&PlatformName=Intel(R)+and+compatible+PCs+running+Windows+95"
: >
: > What I want to do is extract the Application Name and Platform name from
: > this filename. It seems easy, but some reason I am having a hard time
: > with it.
: Did you write a regular expression, and did it work? Here's an idea: I'd
: try matching this in separate steps, since either PlatformName=foo or
: Application=bar might come first, probably. Hope this helps!
Tom! You've got it all wrong!
First I'd use a regexp to cut off everything to the left of the questionmark,
including the questionmark. (something like s/^.*\?//; or s/^.+\?//;)
Then I'd split up the rest of the URL on the '&' sign. (see perlfunc manual,
'split'), then I'd split each element of that on the '=' sign into two
elements each.
Then I might consider using regexps :)
--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com |University or AUCC, thankfully.***** |always!
--
Random sig of the day:
But I *AM* sticking my tongue out!
------------------------------
Date: 07 May 1997 20:55:53 +0200
From: Gisle Aas <aas@bergen.sn.no>
Subject: Re: Perl and fixing dynamic URLS
Message-Id: <h7mhbnmbq.fsf@bergen.sn.no>
Tom Phoenix <rootbeer@teleport.com> writes:
> > I have a file that I "sucked" down that is called the following:
> > "./SELECT_cgi/owa/SOLS.VaultDetail?Application=Engineering+Links%3CSUP%3ET
> > M%3C/SUP>&PlatformName=Intel(R)+and+compatible+PCs+running+Windows+95"
> >
> > What I want to do is extract the Application Name and Platform name from
> > this filename. It seems easy, but some reason I am having a hard time
> > with it.
>
> Did you write a regular expression, and did it work? Here's an idea: I'd
> try matching this in separate steps, since either PlatformName=foo or
> Application=bar might come first, probably. Hope this helps!
Another possibility is to use the URI::URL module:
use URI::URL;
%q = url("./SELECT_cgi/owa/SOLS.VaultDetail?Application=Engineering+Links%3CSUP%3ETM%3C/SUP>&PlatformName=Intel(R)+and+compatible+PCs+running+Windows+95", "http:")->query_form;
print "$q{PlatformName}\n";;
print "$q{Application}\n";
--
Gisle Aas <aas@sn.no>
------------------------------
Date: Wed, 07 May 1997 12:01:04 -0600
From: John Call <johnc@interactive.ibm.com>
Subject: PERL cross reference generator
Message-Id: <3370C35F.1F39@interactive.ibm.com>
I need a cross reference generator for PERL. Anybody know where I can
get one?
Thanks in advance,
John
------------------------------
Date: Wed, 7 May 1997 13:29:57 -0500
From: "Vipul M. Shah" <vipul@xcaliber.com>
Subject: Possible inclusion into FAQ
Message-Id: <5kpvut$3vo@news.xcaliber.com>
For us C/C++ lovers, what is the equivalent of the subscript operator for
strings in Perl. I.e;
how do I write
int n = strlen(s);
int t = 0;
for (int i = 0; i < n; i++)
{
t += (int)s[i];
}
in Perl. Please CC responses to mailto:vipul@xcaliber.com.
_____
Vipul
mailto:vipul@xcaliber.com
------------------------------
Date: Wed, 07 May 1997 20:10:52 GMT
From: mel@west.net
Subject: Re: Problem with uppercase reg exp
Message-Id: <3370e1b4.3805599@news.west.net>
mel@west.net wrote:
>Hi,
>
>I'm somewhat new to PERL and am having a problem with case pattern
>matching. Specifically, I'm trying to convert, for example,
>weight_unit to Weight Unit. So far I've done this:
>
>$x = "weight_unit";
>$x =~ s/_/ /g; # convert underscores to spaces
>$x =~ s/^\ba-z/A-Z/g; # convert 1st letter of each word to uppercase
>
>But all I get back is: weight unit. Can someone help with me with
>this? I've tried some sensible variations, but none worked.
>
>On Mon, 05 May 1997 14:54:37 +0200, Eike Grote wrote in
>comp.lang.perl.misc URL: news:336DD88D.446B@theo.phy.uni-bayreuth.de:
>++
>++ 3) $x =~ s/^\ba-z/A-Z/g;
>++
>++ better forget about this one ...
>++
>++ I think you wanted something like this:
>++
>++ $x =~ s/\b([a-z])/\u$1/g;
>
>But this doesn't capitalize accented letters. Use:
> $x =~ s/\b(\w)/\u$1/g;
>
>Abigail
I'd like to thank everyone for their quick (and surprisingly tactful
:-) replies to my pattern matching problem. I especially appreciate
the explanations of why my original attempt did not work. I'm still
working on interpreting the subtleties of munging, and the
explanations really helped me get a better handle on what was
confusing me.
I tried both solutions and they each worked like a charm (I used the
latter because of its expanded breadth of operation).
BTW, Abigail, I've been a fan of yours in c.i.w.a.h. for some time.
I'm glad to find you sharing your expertise in c.l.p.misc too.
Thanks a bunch,
Milt
------------------------------
Date: 7 May 1997 11:56:51 -0600
From: kannawin@gargantubrain.osmre.gov (Bill Kannawin)
Subject: Re: program for perl?
Message-Id: <5kqfp3$4i2@gargantubrain.osmre.gov>
In article <5kp9kq$2tm$1@marina.cinenet.net>, cberry@cinenet.net (Craig Berry) writes:
|> Michael J Gebis (gebis@purcell.ecn.purdue.edu) wrote:
|> : }Ah, yes, there IS a program needed to write in perl.
|> : }It's called "perl" :)
|> :
|> : Technically, that's the program needed to run perl. You can write in
|> : perl using almost anything, from emacs to antelope blood on a cave wall.
|>
|> Wow, I thought I was the only one doing that! Do you find gazelle blood
|> works as well, or do you really need antelope? I'm experimenting with
|> ibexes (ibices?), too.
|>
|> ---------------------------------------------------------------------
|> | 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."
If you're just starting out, I think a LLama would right, followed by
a camel.
--
Bill Kannawin (303)844-1479 kannawin@osmre.gov|
Technical Information Processing System |
US Office of Surface Mining; 1999 Broadway, |
Suite 3320, Denver, Colorado 80202 |
------------------------------
Date: Wed, 07 May 1997 11:35:25 -0600
From: johnsonn@masirv.com
Subject: Re: replacing escape characters in a text file.
Message-Id: <863022236.13409@dejanews.com>
In article <01bc5ac5$87121e60$5378238a@pc1.asia.compaq.com>,
"cedric tio" <cedric=tio%design%eng=sin@bangate.compaq.com> wrote:
>
> Dear Perl users,
> I need to replace escape characters (^[) in a text file with asterixs.
I
> tried doing s/\^\[/*/g; but it doesn't work.
> Can someone help me with this?
>
> Thanx.
You asked the for a "^" followed imediately by "[" to be replace by a
single "*". This certainly works, I tried it in perl 5.001 with the
following code and text.
#!/usr/local/bin/perl -w
open (INPUT, "<$ARGV[0]") || die "Cannot open $ARGV[0] because $!";
while (<INPUT>) {
s/\^\[/*/g;
print;
}
close INPUT;
Text file was:
This is the text that needs to be fixed ^[ so it will have asterisks.
output was:
This is the text that needs to be fixed * so it will have asterisks.
Perhaps what you said to the computer in not what you mean.
Regards,
Nic Johnson
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 7 May 1997 16:33:40 GMT
From: Salve J Nilsen <sjn@pvv.ntnu.no>
Subject: Re: REQ: Perl obfuscator
Message-Id: <5kqat4$3un@due.unit.no>
And then, Magnus suddenly uttered...
> Is there a perl obfuscator around?
I'm trying to make one nowadays, but have stumbled into some problems
(or perhaps, it's me not having enough time to figure out the
regexp's :)
here's what I've got:
==================================< arghify.pl >==
#!/store/bin/perl
# STORE is a system for installing and maintaining third party
# software on UNIX computers. For more info, take a look at
# URL:http://www.pvv.unit.no/~arnej/store/storedoc_toc.html
require 5.003;
# It's quite important to unset the input record seperator here :)
$/ = undef;
$_ = <>;
# Ideally our MetaSyntactical Variable of Choice should be
# qw(foo bar baz quux quuux quuuux quuuuux) etc - but for simplicity,
# our MetaSyntactical Variable of Choice Today is:
$msv = "foo00";
study;
# single out the first line - if it begins with #!
# and save it for later use...
s/^(\#\!.*?[\n\r])/\n/s;
$head = $1;
# get rid of comments
s/(([\"\'])[^\1]*[^\\]\1)|[^\\]\#.*?$//gm;
# still buggy!
# strip away exess space and newlines
s/(([\"\'])[^\1]*[^\\]\1)|\s+/ $1/gs;
# bugs h^e^r^e too :)
# here we are supposed to swap (Good) variable names
# with (Bad) generic variable names (foo01 foo02 etc).
# - but i can't seem to get it to work :/
# s/([\$\@\%]+)([\w_][\d\w_]*)/$1&foo($2)/gmei;
# My problem lies here ^^^^^^^^^^, I believe.
print $head.$_."\n";
sub foo {
$_{$_[0]}=$msv++ unless $_{$_[0]} && return $_{$_[0]};
}
==================================< arghify.pl >==
The script i still buggy, and quite incomplete, but if any of the RE
gurus out there could help me (us? :), I'd send him/her a Fox in the
mail... (Sorry, we haven't got camels in norway :)
Anyway, as the code is right now - i can do something like this:
18:13 (ra) bin <0>arghify.pl arghify.pl
[snip output]
18:14 (ra) bin <0>arghify.pl arghify.pl | arghify.pl
[snip output]
18:14 (ra) bin <0>arghify.pl arghify.pl | arghify.pl | arghify.pl
[snip output]
.. and get identical output! 8)
> As if lurkers hadn't problems yet reading regexps :-D
> I really need one.
Whatever for? :)
-- Salve Nilsen
--
#!/store/bin/perl
#@(#)RELEASE VERSION .sig V1.02 by Salve J. Nilsen - Hacker, Student, Magician
($_='$ZNVYGB+$FWA?$CII:$BET;')?y:;ZA-Y\:?+${':\nm-za-l.@\:\0:?print:'}.':'.$';
------------------------------
Date: 7 May 1997 14:31:38 GMT
From: dnewman@epnet.com (Dave Newman)
Subject: SDBM on Solaris, and NT
Message-Id: <5kq3oa$6uh$1@sparky.epnet.com>
Hi there,
I have been trying create a DBM file and have it accessable
by both unix and NT. I have a Use SDBM_FILE; to force it to use
the SDBM format. When I create the file under Solaris and read it
under NT I get a ton of binary data catted to the screen and a runtime
error. When I create the file on NT and read it under Solaris I
get a core dump. However, going between Linux and Solaris is fine
so I know that the byte order is not an issue. I am using perl 5.003
on all platforms. Has anyone had any experience with this? Thanks.
--
David Newman
System Administrator
EBSCO Publishing
dnewman@epnet.com
------------------------------
Date: Wed, 07 May 1997 09:53:41 -0700
From: Slava V Bereza <vvbereza@russiamail.com>
Subject: split problem
Message-Id: <3370B395.690A@russiamail.com>
Hi,
Does anybody knows how to split lines if I have a number of
delimiters in row? If I have two or more whitespaces, I get
whitespaces in my array after splitting. I do not what it.
Also how is it possible to give different delimiters in one split?
Thanks in advance.
Slava Bereza.
http://www-ida.ucsd.edu/~bereza
------------------------------
Date: 07 May 1997 12:29:56 -0700
From: Russ Allbery <rra@stanford.edu>
To: Slava V Bereza <vvbereza@russiamail.com>
Subject: Re: split problem
Message-Id: <m3sozzm66j.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Slava V Bereza <vvbereza@russiamail.com> writes:
> Does anybody knows how to split lines if I have a number of delimiters
> in row? If I have two or more whitespaces, I get whitespaces in my array
> after splitting. I do not what it. Also how is it possible to give
> different delimiters in one split?
split takes a regular expression as the delimiter, so you can build
whatever arbitrary delimiter expression you want and ensure that it
matches everything you want to get rid of. For example, if you have:
field1|field2|||field3||field4
and don't want each of the recurrences of | to start a new field, you can
use:
split (/\|+/, $line)
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: 7 May 1997 17:54:49 GMT
From: rmach@piranesi.engin.umich.edu (Rodney Mach)
Subject: Splitting terminal window in 2 with perl
Message-Id: <5kqfl9$r68@srvr1.engin.umich.edu>
Hi, I am using termcap.pl with perl, and currently have a perl script
which splits the screen in half. I want to perform like what emacs -nw
does, when I type M-x shell the shell appears in the bottom half of
the vt100 terminal screen, leaving the top half alone. Whatever I type
in the bottom half, the top half of the screen is left alone. The problem
occurs when I type something like:
rm -i /tmp/*
once the bottom half screen fills up, it starts moving up into the top half
of the screen.
Basically what I do is move the cursor to the middle of the screen with
&Tputs(&Tgoto($TC{'cm'}, $col, $row), 0, 'STDOUT');
Then do like a
system("/bin/csh");
and I want all the output to stay below where I moved the cursor from the
first command. I can't figure out how to do this. I looked at the
termcap book by oreilly, and couldn't find any reference or tips on
how to keep the screen split. My first idea was to read all the information
into a buffer, then keep track of how many lines I had on the screen and
output the output 1/2 page at a time. I ran into a snag with the "rm -i"
example because I need interactive input in the bottom of the screen,
reading into a buffer doesn't allow me to interact.
If anyone has a good idea of the thought process to accomplish this,
that would be great.
-rod
rmach@engin.umich.edu
------------------------------
Date: Wed, 07 May 1997 17:25:28 +0200
From: "Fischer (Softing)" <fischer@hgz25.hub.de>
Subject: Strange effect
Message-Id: <33709EE7.2116@hgz25.hub.de>
Hello!
Can anybody help me with the following question?
Start the little program below with the print-line
commented and uncommented. The result will be different.
Why is this?
Anyway if the print-line is commented, the value of $x immediately
after $x = 1 is NOT 1. Why?
This all seems to be connected with the 'my' in the body of the
if-part. What happens exactly?
Can anybody reproduce this effect? I used version 5.002.
Can anybody expalin this effect?
thank you very much
F.Fischer
---> cut here
#!/usr/local/bin/perl -w
#=== use this one with perl version 5.002
my $x = 0;
if (0) {
my $x = 1;
} else {
#=== uncommenting the next line has an effect on the value of $x
#=== WHY IS THIS ?
print "foo\n";
$x = 1;
print "x is $x\n";
}
---> cut here
------------------------------
Date: Wed, 7 May 1997 16:19:57 GMT
From: stephen farrell <stephen+usenet@farrell.org>
Subject: Re: Strange effect
Message-Id: <87sozzxniq.fsf@phaedrus.uchicago.edu>
"Fischer (Softing)" <fischer@hgz25.hub.de> writes:
> Hello!
>
> Can anybody help me with the following question?
> Start the little program below with the print-line
> commented and uncommented. The result will be different.
> Why is this?
> Anyway if the print-line is commented, the value of $x immediately
> after $x = 1 is NOT 1. Why?
> This all seems to be connected with the 'my' in the body of the
> if-part. What happens exactly?
> Can anybody reproduce this effect? I used version 5.002.
Yes. 5.003. It appears to also be related to the if/else jobber.
> Can anybody expalin this effect?
No, not at all.
>
> thank you very much
>
> F.Fischer
>
> ---> cut here
> #!/usr/local/bin/perl -w
>
> #=== use this one with perl version 5.002
>
>
> my $x = 0;
>
> if (0) {
> my $x = 1;
> } else {
> #=== commenting the next line has an effect on the value of $x
> #=== WHY IS THIS ?
> print "foo\n";
> $x = 1;
> print "x is $x\n";
> }
> ---> cut here
--steve farrell
------------------------------
Date: 7 May 1997 19:09:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Strange effect
Message-Id: <5kqk0o$ah0@lyra.csx.cam.ac.uk>
Fischer (Softing) <fischer@hgz25.hub.de> wrote:
>Can anybody help me with the following question?
>Start the little program below with the print-line
>commented and uncommented. The result will be different.
Known bug in 5.002 and 5.003. Mended in the 5.004gamma (5.003_99).
Mike Guy
------------------------------
Date: 7 May 1997 18:11:08 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: TIEARRAY Q
Message-Id: <5kqgjs$7ui@lyra.csx.cam.ac.uk>
In article <336F6145.31AF@bear.com>, Buzz Moschetti <buzz@bear.com> wrote:
>Assume that TieTest is a class package to tie a normal array.
>It seems that once I tie an array, I cannot use it as a normal
>array outside of the STORE/FETCH context.
>
>I'm sure (well, actually, hoping) that it is merely a misunderstanding
>on my part of how to start up sub TIEARRAY.
"Fraid not. The perltie pod confesses
Tying Arrays
A class implementing a tied ordinary array should define the
following methods: TIEARRAY, FETCH, STORE, and perhaps
DESTROY.
WARNING: Tied arrays are incomplete. They are also
distinctly lacking something for the $#ARRAY access (which
is hard, as it's an lvalue), as well as the other obvious
array functions, like push(), pop(), shift(), unshift(), and
splice().
So you've hit the limits of the known universe. AFAIK, all you can do
with tied arrays is simple fetches and stores.
And that won't change in Perl 5.004. Completing tied arrays is on the
to-do list for 5.005, but I don't think anyone has volunteered to do the
work yet.
Offers of patches always welcome.
MIke Guy
------------------------------
Date: 7 May 1997 16:34:47 GMT
From: cybersalem@algorists.com (Jeffrey Kegler)
Subject: What does Familiar Mean? [Intel v. Schwartz]
Message-Id: <5kqav7$jqr@samba.rahul.net>
Letter from Cybersalem 8
What Does Familiar Mean?
by Jeffrey Kegler
>From the cross-examination of Rich Cower, Intel Network Security
Expert and State's Expert for the prosecution, by Marc Sussman,
Randal's lawyer:
Sussman: "Are you familiar with a book entitled [ Firewalls
and Internet Security, Repelling the Wily Hacker, by William
Cheswick and Steven Bellovin ]"
Cower: "What does 'familiar' mean?"
Sussman: "Have you seen their book?"
Cower: "I ever seen it?"
Sussman: "Do you recognize it as --"
Cower: "That's a new book."
Sussman: "One that's reliable, kind of an authority on this
subject?"
Cower: "It's a new book." [1]
Those who are in the Internet security field should find the
above responses from someone purporting to be an expert in their
field stand on their own. Not all my readers will be in the
field, however, so I'll supply some background.
Cheswick and Bellovin, coming out in June 1994, [2] was the first
book on firewall-based Internet security, [3] and filled what had
become a desperate need. More and more enterprises were hooking
networks with sensitive data onto the Internet, and information
on how to do this securely had to be found in papers,
proceedings, talks, classes and class notes.
"With the wholesale rush to Internet connectivity, its about
time someone sat down and wrote a good book about how to do
this exercise safely! And, sure enough, Cheswick and
Bellovin have done just that." [4]
C&B's timeliness and authority instantly made it into something
of an icon in the field. By now, C&B has quality competition,
but it is still universally recognized as an authority.
Cliff Stoll: "I wish that Cheswick and Bellovin had written
this 6 years ago. I could have nailed down my system and
avoided chasing a spy around the world."
Datamation: "The most popular text on the subject."
ATM User: "Make this book required reading by anybody
responsible for your LANs and internetworks."
SCO World: "Consider by many the definitive book on Internet
security."
Linux Journal: "... has no rival ... Anyone in charge of
installing or administering an Internet firewall would be
insane not to get a copy."
Uniforum Monthly: "Anyone who has to administer a network of
computers or is thinking of connecting to the Internet ought
to read this book first. ... To miss the opportunity to
benefit from their advice and experience borders on the
foolhardy." [5]
Not only does the Intel-titled and court-recognized Internet
security expert refuse to acknowledge the reliability or
authority of the most highly regarded book in what is supposedly
his field, he does not even recognize the cover. Even as fakery,
this is pretty poor stuff.
Finally, for those who, like Rich Cower, do not know what
familiar means, I will use the word in some sample contexts:
It is a familiar, if sad, fact of life for those who take the
trouble to become competent in technical fields, that those
who do not often have the advantage over them.
Those who simply tell others what they expect or want to
hear, clearly have a ready ear; for what they say will have a
familiar ring to it, which many mistake as a sign of truth.
They may well consider it unnecessary to learn the truth and
those who undertake that trouble fools.
Those who make themselves familiar with difficult
technologies must face the further difficulty of explaining
to others things they find strange, implausible or
unpleasant.
Situations where the competent find themselves the prey of
the willfully ignorant are all too familiar.
===========================================================
The Friends of Randal Schwartz Web site archives the material on
all sides of this issue, including the trial transcripts:
<URL:http://www.lightlink.com/fors>.
Of the many opportunities to do something, three head the list:
1.) To sign a letter objecting to Intel's role in this sorry
matter, see <URL:http://www.lightlink.com/fors/us2intel>.
2.) To sign a letter to the Computer Law Committee of Oregon
State Bar, see <URL:http://www.lightlink.com/fors/us2oregon>.
3.) To get an auto-reply giving Randal's own statement, and
discussing how you can contribute to his Legal Defense Fund, send
an empty message to <URL:mailto:fund@stonehenge.com>
Permission is granted to freely copy the Cybersalem Letters in
electronic form, or to print them for personal use.
===========================================================
Note 1: <URL:http://www.lightlink.com/fors/court/7-24-95.txt>,
page 58, lines 7 to 17. The court reporter mangled the title and
authors, though it is quite clear which book is intended. Here I
have repaired the reference. The above URL contains the
transcript unaltered.
Note 2: According to amazon.com. My copy is June 1994, but it's
a second printing. However, it seems quite possible this book
went into a second printing the month it was published.
Note 3: <URL:http://www.anatomy.su.oz.au/danny/book-
reviews/h/Firewalls_and_Internet_Security.html>. This seems to
be the same review that the Linux Journal printed.
Note 4: From Ray Kaplan's May 2, 1994 posting, based on his
already dog-eared March 1994 review copy. It apparently went to
RISKS and comp.security.announce among other places. It's at
<URL:http://www.netsys.com/firewalls/firewalls-9405/0015.html>.
Note 5: The Stoll, Datamation, ATM User, SCO World, Linux
Journal and Uniforum Monthly quotes are collected at the
publishers website: <URL:http://aw.com/cp/Ches.html>. Those for
whom this is not enough can ask any Internet security expert --
any real one, that is -- or can fire up their favorite search
engine. "A must" says a page entitled "Good Books (and other
resources) on BSD/OS and Related Subjects":
<URL:http://www.albatross.com/booklist.html>. Also see
<URL:http://www.gta.com/links.html> or
<URL:http://www.jobsoft.com/~klf/work/security.html>.
------------------------------
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 446
*************************************