[13891] in Perl-Users-Digest
Perl-Users Digest, Issue: 1335 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 10 03:05:35 1999
Date: Wed, 10 Nov 1999 00:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942221111-v9-i1335@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 10 Nov 1999 Volume: 9 Number: 1335
Today's topics:
Re: command line args to "perl" <lr@hpl.hp.com>
Re: garbage collection <sjs@yorku.ca>
Re: list (array) programming question (Craig Berry)
Re: list (array) programming question (Craig Berry)
Re: parsing structured text (e.g., lisp or tcl output) (Abigail)
Re: perl as first language? (Martien Verbruggen)
Re: perl as first language? <jhagen@blarg.net>
Re: perl as first language? (Andrew Johnson)
Re: perl as first language? (Damian Conway)
Re: perl as first language? (Sam Holden)
Re: perl as first language? (Damian Conway)
Re: PERLHUMOR: self-printing resume <uri@sysarch.com>
Re: PERLHUMOR: self-printing resume (Sam Holden)
Re: regular expression help (Abigail)
Re: regular expression help <wyzelli@yahoo.com>
Sample TCP/IP Client / Server routine in NT hdesa22@my-deja.com
weird bugs? (GiN)
Re: XS routines & stack (Ilya Zakharevich)
Re: YA Find/Replace newbie question <octothorpe12NOocSPAM@yahoo.com.invalid>
Re: YA Find/Replace newbie question (Sam Holden)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 9 Nov 1999 21:00:03 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: command line args to "perl"
Message-Id: <MPG.12929bb1c24063d598a1cd@nntp.hpl.hp.com>
In article <3829145E.D7213CA0@worldnet.att.net> on Tue, 09 Nov 1999
22:44:46 -0800, Seshadri Sriperumbudur <seshadri9@worldnet.att.net>
says...
> Where can I find more about all the command line args to "perl"; I mean,
>
> shell % perl -p -i -e ....
>
> I want to know what each one of the letters (p, i , e) stands for and
> also about other letters. Is there a book, webpage which describes all
> these things at one place?
perldoc perlrun
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 10 Nov 1999 01:43:47 -0500
From: Steven Smolinski <sjs@yorku.ca>
Subject: Re: garbage collection
Message-Id: <m3so2ealss.fsf@hank.yorku.ca>
Tom Briles <sariq@texas.net> writes:
> Jean-Patrick Madelon wrote:
> > What kind of garbage collection and automatic resource does it have if any?
> Well, I've been programming in Perl for years now, and I *still* have to
> manually put my garbage out on the curb every Monday morning.
> Sometimes, I'll do it Sunday night so that I won't forget.
I've tried removing all reference to my garbage in hopes that my perl will then
take it out, but alas, no luck.
I hope Java's garbage collection is better, maybe I'll do my apartment in Java
soon.
:)
Steve
------------------------------
Date: Wed, 10 Nov 1999 06:27:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: list (array) programming question
Message-Id: <s2i42h2p6i716@corp.supernews.com>
Tad McClellan (tadmc@metronet.com) wrote:
: >
: >one
: >one two
: >one three
: >one two three
: >two
: >two three
: >three
:
: But that is not "all possible unique combinations".
: It is missing
:
: two one
:
: for instance...
That's not a combination, that's a permutation. These terms have precise
meanings in this domain.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Wed, 10 Nov 1999 07:08:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: list (array) programming question
Message-Id: <s2i6f3deg5i62@corp.supernews.com>
Another WTDI, based on binary counting with bits corresponding to set
membership:
#!/usr/bin/perl -w
# combine - display all nonempty combinations of the arguments
# Craig Berry (19991109)
use strict;
my @combos = combine(@ARGV);
foreach my $ar (@combos) {
print join(' : ', @$ar), "\n" if @$ar;
}
sub combine {
my @combos;
for (my $pattern = 0; $pattern < 2 ** @_; $pattern++) {
my @set;
for (my $bit = 0; $bit < @_; $bit++) {
push @set, $_[$bit] if $pattern & (1 << $bit);
}
push @combos, [ @set ];
}
return @combos;
}
__END__
Demo:
one
two
one : two
three
one : three
two : three
one : two : three
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: 10 Nov 1999 00:25:56 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: parsing structured text (e.g., lisp or tcl output)
Message-Id: <slrn82i46d.6es.abigail@alexandra.delanet.com>
Sam Steingold (sds@goems.com) wrote on MMCCLXI September MCMXCIII in
<URL:news:uhfivi6a1.fsf@ksp.com>:
[] I looked at the FAQs, but could not find any references:
[]
[] Suppose I need to parse some structured text, like this
[]
[] (first (1 2 3 4) (5 (6 (7) 8) 9) 10)
[]
[] the spaces could be any /\s+/; instead of "()" I might have "{}" or "[]"
[] or whatever.
[]
[] I want to get an array with 4 elements - (1) "first", (2) reference to
[] an array (1, 2, 3, 4), (3) reference to another array of 3 elements and
[] (4) "10".
#!/opt/perl/bin/perl -w
use strict;
use Parse::RecDescent;
use Data::Dumper;
my $line = '(first (1 2 3 4) {5 [6 (7) 8] 9} 10)';
print Dumper (Parse::RecDescent -> new (<<'GRAMMAR') -> start ($line));
{my %brace = qw /[ ] { } ( )/;}
start: element
list: /[[({]/ element(s?) "$brace{$item[1]}" {$item [2]}
element: list | /\w+/
GRAMMAR
__END__
$VAR1 = [
'first',
[
1,
2,
3,
4
],
[
5,
[
6,
[
7
],
8
],
9
],
10
];
[] Another thing: a text file with data like this:
[]
[] -----
[] name= "first" type=
[] "character" values= {"a", "1", "x"}
[] name= "second" format= "%s"
[] -----
[]
[] You get the idea - basically, I want the full power of the lisp's READ.
You get the idea - basically, use a parser.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 10 Nov 1999 05:20:05 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: perl as first language?
Message-Id: <9g7W3.262$Y86.7686@nsw.nnrp.telstra.net>
On 9 Nov 1999 23:00:17 -0600,
Abigail <abigail@delanet.com> wrote:
> Martien Verbruggen (mgjv@comdyn.com.au) wrote on MMCCLXII September
> MCMXCIII in <URL:news:uh4W3.164$Y86.3863@nsw.nnrp.telstra.net>:
> !! But, Damian, your own book (OO Perl) shows some pretty good examples
> !! of how decent code can be written in Perl. It also explains a few of
> !! the dangers in the same, but that just comes back to learning things
> !! from a good source, instead of just diving in.
>
> The ability to write decent code in a language isn't the same as the
> language being suitable as a first language. With that argument, any
> language would either be suitable as a first language, or it would
> be impossible to write decent code in it.
Agreed. The point was probably more that Perl can be taught in a
decent way. And that it can be taught in a structured way. The fact
that Perl has many ropes doesn't mean you need to tell people about
them until they really start needing them.
> !! Don't misunderstand me; I've already agreed that for educational
> !! puproses and general programming other languages than the ropey ones
> !! are more applicable. But I maintain that for sysadmin tasks it will
> !! probably be a waste of time to learn a heavily structured language
> !! first; because after that you will want to apply it to your day to day
> !! administration task, and you'll find out that you can't do bugger all.
> !! Or if you can do it at all, it looks and feels totally alien to the
> !! language at hand.
>
> Which leads to flocks of system administrators who can't program anything
> beyond a 3 line csh script. I've seen and worked with them. They tend
> to be promoted to managers.
I've worked with those. I've also worked with sysadmins who could
write a very decent program, with a background in nothing but C,
shells and Perl. I don't think you can prove this point by pointing at
a few personal experiences.
Again: I do agree that the best way to learn programming is to use a
language that restricts. But I also recognise the reality of a
sysadmin not having unlimited time to learn to program in Pascal first
(which can take quite some time), then to learn how to do the same
thing in C or Perl or both, and then to have to unlearn certain Pascal
things to be able to make use of the powers of C or Perl.
In an ideal world, that's the route people would follow, and many good
programmers have probably done something approximating that, and it
probably took them many years to get there.
But that still doesn't mean that Perl cannot be a good first language
:)
Martien
PS. I'm beginning to get dizzy. We're going in circles... weeeeeh
--
Martien Verbruggen |
Interactive Media Division | Hi, John here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: Tue, 09 Nov 1999 21:36:15 -0800
From: John Hagen <jhagen@blarg.net>
Subject: Re: perl as first language?
Message-Id: <3829044F.FEE8B0F7@blarg.net>
Abigail wrote:
>
> Jean-Louis Leroy (jll@skynet.be) wrote on MMCCLXI September MCMXCIII in
> <URL:news:m3so2fz3l9.fsf@enterprise.newedgeconcept>:
> "" > I disagree with Perl, for the same reason I don't recommend C. It's way
> "" > too messy and there's too much rope.
> I think this group shows clearly Perl is not a suitable first language.
Having learned BASIC, Fortran, Perl, C and now C++ (and in that order!)
I have to agree. I consider Perl a baroque language full of magnificent
and exquistely hard to understand details.
I would also say that learning C and C++ _before Perl would have given
me a better leg up on references and the OO parts of Perl.
Knowing something about the languages mentioned above gives one a firm
appreciation of the wonderful things Perl is doing for you under the
hood..
Cheers,
--
john hagen ~ jhagen@blarg.net
=============================
------------------------------
Date: Wed, 10 Nov 1999 06:05:22 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: perl as first language?
Message-Id: <CW7W3.1277$Zu4.27139@news1.rdc1.mb.home.com>
In article <slrn82huq8.6es.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
[snip]
! I think this group shows clearly Perl is not a suitable first language.
hmm, I think this group shows more clearly that clpm is not a
suitable first usenet group.
however, there have also been indications that Perl has not had a
suitable first language book either :-)
andrew
--
Andrew L. Johnson http://www.manning.com/Johnson/
I've always maintained a cordial dislike for indent, because it's
usually right.
-- Larry Wall in <199806221558.IAA07251@wall.org>
------------------------------
Date: 10 Nov 1999 06:30:05 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: perl as first language?
Message-Id: <80b3dd$4qn$1@towncrier.cc.monash.edu.au>
Uri Guttman <uri@sysarch.com> writes:
> DC> Of course, I'm coming from the point of view of someone who daily
> DC> struggles to teach large classes (300+) of absolute novices how to
> DC> program. I have ceased to be astounded at how easily subtleties of
> DC> syntax and semantics can hopelessly befuddle them.
>yoiks!! have you looked at using elements of programming in perl
>(published by manning who you know and love)? i am just getting into it
>and the first chapters are aimed at those newbies.
Alas, I am *required* to teach C as a first programming language.
(I know! I know! Don't get me started...)
> DC> McIver, L and Conway, D.M., "Grail: A Zeroth Programming Language",
> DC> Proc. International Conference on Computers in Education '99.
> DC> in which we describe a minimalist introductory language that avoids
> DC> most of the problems of syntactic and semantic "ropiness".
>on the web anywhere?
http://www.cs.monash.edu.au/~lindap/papers/ZerothGrail.ps
but read:
http://www.cs.monash.edu.au/~damian/papers/PS/SevenDeadlySins.ps
first to understand why we left so much out.
> better (i hope and pray) than (pick one) pascal,
>lisp, algol, c, pl/1 java, c++? all have been chosen by foolish
>educators as first languages.
We think so, but we're coming from a very different angle. Most
people won't like it, even though we have studies that indicate real
benefits :-(
Damian
------------------------------
Date: 10 Nov 1999 06:55:18 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: perl as first language?
Message-Id: <slrn82i5n0.et.sholden@pgrad.cs.usyd.edu.au>
On 10 Nov 1999 06:30:05 GMT, Damian Conway <damian@cs.monash.edu.au> wrote:
>Uri Guttman <uri@sysarch.com> writes:
>
>> DC> McIver, L and Conway, D.M., "Grail: A Zeroth Programming Language",
>> DC> Proc. International Conference on Computers in Education '99.
>
>> DC> in which we describe a minimalist introductory language that avoids
>> DC> most of the problems of syntactic and semantic "ropiness".
>
>>on the web anywhere?
>
> http://www.cs.monash.edu.au/~lindap/papers/ZerothGrail.ps
That really doesn't look like a postscript file...
--
Sam
Even if you aren't in doubt, consider the mental welfare of the person
who has to maintain the code after you, and who will probably put parens
in the wrong place. --Larry Wall
------------------------------
Date: 10 Nov 1999 07:17:22 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: perl as first language?
Message-Id: <80b662$54b$1@towncrier.cc.monash.edu.au>
sholden@pgrad.cs.usyd.edu.au (Sam Holden) writes:
>> http://www.cs.monash.edu.au/~lindap/papers/ZerothGrail.ps
>That really doesn't look like a postscript file...
Oops, you're right. Looks like my student left some weird HP formatted
monstrosity where the PostScript should be :-(
Unfortunately she's in Japan presenting the paper and won't be back till
December :-( :-(
Apologies all round, but it seems I don't have a copy available until
then.
Damian
------------------------------
Date: 10 Nov 1999 00:10:07 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: PERLHUMOR: self-printing resume
Message-Id: <x7hfivylsg.fsf@home.sysarch.com>
>>>>> "BL" == Brian Landers <bcl914@bellsouth.net> writes:
BL> I was bored, and working on a new resume for some perl jobs I'm
BL> trying for, and I decided "why not do my resume IN perl?" You can
BL> read it or execute it.
well, you asked for this!
BL> #!/usr/bin/perl
BL> # --------------------------------------------------------------
no -w nor strict!
BL> my( $name ) = "BRIAN CLAY LANDERS, MCP";
BL> my( %addr ) = (
BL> POSTAL => 'xxx Collier Road #xxxx' .
BL> 'Atlanta GA 30318',
BL> HOME => '404-xxx-xxxx',
BL> CELL => '678-xxx-xxxx',
BL> EMAIL => 'brian@bluecoat93.org',
BL> WEB => 'http://www.bluecoat93.org'
BL> );
BL> my( %work );
BL> $work{ "1. SAPIENT CORPORATION" } = {
you sort on that key but if you ever get more than 10 jobs, it will not
work.
BL> my( $references ) = q{
for long strings i like here doc better than q with braces. just a style
issue.
BL> Joanna Schull - Director of IT & Operations
BL> };
some white space below would be nice.
BL> print "$name\n\n";
BL> foreach(keys %addr)
BL> {$a=lc($_);$a=~s/\b(.)/\U$1/g;print "$a\t$addr{$_}\n\n";};
print "\u\L$_\E\t$addr{ $_ }\n\n" ;
also you my all the vars above, why not $a? strict would have caught it.
also the fields come out in hash order which doesn't look so great.
BL> print "\nWORK EXPERIENCE\n\n";
BL> foreach(sort keys %work){
BL> $a=lc($_);$a=~s/^\d\. file://g;$a=~s/\b(.)/\U$1/g;
same as above.
cute idea, but should be better perl and format the resume better. i
have a very simplistic script that converts my text resume to an html
one. check it out on my site. if i added the raw text as data i could
rework it to generate both at the same time. i doubt i will hack that.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 10 Nov 1999 05:20:21 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: PERLHUMOR: self-printing resume
Message-Id: <slrn82i04v.sr1.sholden@pgrad.cs.usyd.edu.au>
On Tue, 9 Nov 1999 23:50:35 -0500, Brian Landers <bcl914@bellsouth.net> wrote:
>I was bored, and working on a new resume for some perl jobs I'm trying for,
>and I decided "why not do my resume IN perl?" You can read it or execute it.
>
>la la la,
>Brian
>
>
>#!/usr/bin/perl
Leaving off the -w and use strict is not a wise thing on a resume for a
perl job...
># --------------------------------------------------------------
>
>my( $name ) = "BRIAN CLAY LANDERS, MCP";
>my( %addr ) = (
> POSTAL => 'xxx Collier Road #xxxx' .
> 'Atlanta GA 30318',
<snip more of the same...>
>
># --------------------------------------------------------------
># END OF RESUME - The following Perl is deliberately compacted
># for space, and is not written for clarity.
>#
># You can run this resume using Perl to make it display itself.
># --------------------------------------------------------------
>
>print "$name\n\n";
>foreach(keys %addr)
> {$a=lc($_);$a=~s/\b(.)/\U$1/g;print "$a\t$addr{$_}\n\n";};
<snip more compacted perl code which may not be wise to place on the
resume for a perl job>
Of course you could always just use the command line options perl provides
and do something as simple as :
#!/usr/local/bin/perl -wpeif($.==1){$_=''}
Name: Sam Holden
Adress: Over here...
etc,etc,etc....
I'm sure there is an easier way... using sed is the obvious one...
#!/usr/bin/sed 1d
insert resume here...
--
Sam
There's no such thing as a simple cache bug.
--Rob Pike
------------------------------
Date: 9 Nov 1999 23:31:26 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: regular expression help
Message-Id: <slrn82i0se.6es.abigail@alexandra.delanet.com>
Ivan Berg (Iceberg@groovy.msu.montana.edu) wrote on MMCCLXI September
MCMXCIII in <URL:news:Pine.LNX.4.10.9911091457360.23555-100000@groovy.msu.montana.edu>:
() Ok, you regular expression experts
()
() How would you grab all text after 6 periods in a string.
()
() For example, in the string
()
() "blah.23.0993.cs.monkey.s.This.is.what,I.want"
()
() I could get "This.is.what,I.want"
$str =~ s/^([^.]*[.]){6}//;
$str = (split /\./ => $str, 7) [6];
$str = do {my $o = 0; $o = index $str => ".", 1 + $o for 1 .. 6;
substr $str => 1 + $o};
$str = do {local $_ = reverse $str; my $i = 0;
{my $c = chop; redo if $c ne '.' || ++ $i != 6}
reverse $_};
$str = do {my $i = 0; join "." => grep {++ $i > 6} split /\./ => $str};
Note that they all fail in various ways if no 6 periods are present.
Making them work is left as an exercise for the reader.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 10 Nov 1999 15:04:42 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: regular expression help
Message-Id: <Rt7W3.6$tT3.522@vic.nntp.telstra.net>
Abigail <abigail@delanet.com> wrote in message
news:slrn82i0se.6es.abigail@alexandra.delanet.com...
>
> $str =~ s/^([^.]*[.]){6}//;
> $str = (split /\./ => $str, 7) [6];
> $str = do {my $o = 0; $o = index $str => ".", 1 + $o for 1 .. 6;
> substr $str => 1 + $o};
> $str = do {local $_ = reverse $str; my $i = 0;
> {my $c = chop; redo if $c ne '.' || ++ $i != 6}
> reverse $_};
> $str = do {my $i = 0; join "." => grep {++ $i > 6} split /\./ =>
$str};
TMTOWTDI allright!
>
> Abigail
> --
Wyzelli
------------------------------
Date: Wed, 10 Nov 1999 05:59:08 GMT
From: hdesa22@my-deja.com
Subject: Sample TCP/IP Client / Server routine in NT
Message-Id: <80b1jc$7ev$1@nnrp1.deja.com>
I am looking for sample code that demonstrates a simple Client - Server
link usng TCP/IP sockets in NT.
The Sample in the "Camel" Book seems to hang when the data reaches and
is displayed at the server.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 10 Nov 1999 06:32:38 GMT
From: GiN@hookers.org (GiN)
Subject: weird bugs?
Message-Id: <slrn82kp70.7c.GiN@Avelon.net>
hello,
i have some really weird protocol problems with perl.
2 examples:
i opened a socket "S"
print S "HEAD \/ HTTP\/1.0\n\n"; # http
and
print S ".\n"; # (e)smtp
if i do this in C, it works.
but in perl it doesn't. i think the server couldn't get the "\n" so it
just waits
who can tell me what i'm doing wrong?
--
Debian Linux -- Your next Linux distribution.
If you can't do it in Perl, you don't want to do it.
#Phreak.nl http://www.casema.net/~gin
------------------------------
Date: 10 Nov 1999 06:16:09 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: XS routines & stack
Message-Id: <80b2j9$ohi$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Peter
<zed@linux.com>],
who wrote in article <3828F8F1.A01191F9@linux.com>:
> I'm having a little problem, and wondering if anyone has the
> answer. I want to know what is a good way to return large
> amounts of information from a XS routine?
Good for what? If you going to use it, the information *should* be
put somewhere. But if you always assign to an array, you may want to pass
a reference to this array, then set its elements directly.
> Here is an example of what I'm doing now, but it's a real
> stack basher: (replies to zed@linux.com please).
>
> XS (XS_IRC_ignore_list)
> {
> struct ignore *ig;
> GSList *list = ignore_list;
> int i = 0;
> dXSARGS;
> items = 0;
>
> while (list)
> {
> ig = (struct ignore *) list->data;
>
> XST_mPV (i, ig->mask);
> i++;
I would extend stack once at start, then would use non-extending macros.
Ilya
------------------------------
Date: Tue, 09 Nov 1999 22:08:53 -0800
From: visigothe <octothorpe12NOocSPAM@yahoo.com.invalid>
Subject: Re: YA Find/Replace newbie question
Message-Id: <000b8d9b.ef5b8ef0@usw-ex0106-041.remarq.com>
In article <3828C05A.FF509AD9@mail.cor.epa.gov>, David Cassell
<cassell@mail.cor.epa.gov> wrote:
> >visigothe wrote:
<<<SNIP>>>
> Hmmm. Well, if you have Perl on your machine or your network,
> you have Perl's FAQ. It [and far more documentation and
> tutorial material] comes with the install. If that's not an
> option, go to www.perl.com and follow the links to the FAQ.
> Then you can have your own personal copy.
Ah... indeed. I was actually referring to the NG's FAQ... I didn't even
*know* Perl had a FAQ... I have looked it over, and it does answer a
*lot* of my Qs.
<<<<SNIP>>>>
> > OK great. now what? Do I make the above one big variable and
> replace
> > $nukeme with $newdata?
> That is one option. You could do that with the substitution
> operator s/// [read the perlre and perlop pages for more details].
Actually isn't that the *only* option? doing a
$slug =~ s/$nukeme/$newdata/
> > Really silly Q; but how would I go about putting that huge
> textblock
> > into a variable? just put quotes around it and escape all the
> funky
> > chars?
> A here-doc is a much better idea. If you have experience
> with shell programming, you know about that already. If not,
> read the perldata page which comes with Perl to learn how to
> do it.
Yes, I am familliar w/ that... again, dumbass attack. Didn't know Perl
could.
>
> > Is there a better way to do all of this?
> You may find the HTML::Template module to be a help here. All
> modules are available at CPAN [www.cpan.org],
I considered it, and I guess I still am, but I figg'd hey... it's only
a small script, why bother using *another* module. [granted... it's not
like I'll have speed/overhead issues, I am gonna be the only one using
it]
I still wonder if I am missing something totally obvious, that would
make this much simpler [read less lines of code. To me it seems that I
am going about this in a rather "piggy" manner Hmmm.
<<<<SNIP>>>>
> David
Thanks a bunch
CMH
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: 10 Nov 1999 06:51:19 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: YA Find/Replace newbie question
Message-Id: <slrn82i5fh.et.sholden@pgrad.cs.usyd.edu.au>
On Tue, 09 Nov 1999 22:08:53 -0800, visigothe wrote:
>In article <3828C05A.FF509AD9@mail.cor.epa.gov>, David Cassell
><cassell@mail.cor.epa.gov> wrote:
>> > OK great. now what? Do I make the above one big variable and
>> replace
>> > $nukeme with $newdata?
>
>> That is one option. You could do that with the substitution
>> operator s/// [read the perlre and perlop pages for more details].
>
>Actually isn't that the *only* option? doing a
>$slug =~ s/$nukeme/$newdata/
No. Assuming that $nukeme represents a string and not a regular expression
then you could use :
substr($slug,index($slug,$nukeme),length($nukeme)) = $newdata;
Of course this should be done in at least two steps, since if $slug doesn't
contain $nukeme, then it is not going to do what you want.
--
Sam
these days you're allowed to patent natural laws, and even other people's
genomes.
-- Tom Christiansen in <374b0ddd@cs.colorado.edu>
------------------------------
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 1335
**************************************