[16173] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3585 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 18:08:39 2000

Date: Mon, 10 Jul 2000 15:08:24 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963266904-v9-i3585@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 10 Jul 2000     Volume: 9 Number: 3585

Today's topics:
    Re: Newbie questions: treating a scalar string as an ar (Bernard El-Hagin)
    Re: Newbie questions: treating a scalar string as an ar <o1technospam@skyenet.nospam.net>
    Re: Newbie questions: treating a scalar string as an ar (Eric Bohlman)
    Re: Newbie questions: treating a scalar string as an ar <aqumsieh@hyperchip.com>
    Re: Newbie questions: treating a scalar string as an ar <o1technospam@skyenet.nospam.net>
    Re: Newbie questions: treating a scalar string as an ar <yosikim@lgeds.lg.co.kr>
        Newbie questions: treating a scalar string as an array  <o1technospam@skyenet.nospam.net>
    Re: Newbie questions: treating a scalar string as an ar <nnickee@nnickee.com>
    Re: Newbie questions: treating a scalar string as an ar <tina@streetmail.com>
    Re: Newbie questions: treating a scalar string as an ar <aqumsieh@hyperchip.com>
    Re: Newbie questions: treating a scalar string as an ar (Craig Berry)
    Re: Newbie questions: treating a scalar string as an ar <o1technospam@skyenet.nospam.net>
    Re: Newbie questions: treating a scalar string as an ar <o1technospam@skyenet.nospam.net>
    Re: Newbie questions: treating a scalar string as an ar <o1technospam@skyenet.nospam.net>
    Re: Newbie questions: treating a scalar string as an ar <aqumsieh@hyperchip.com>
    Re: Newbie questions: treating a scalar string as an ar <o1technospam@skyenet.nospam.net>
        Newbie regular expression problem <jjgreenaway@no.junk.please.ntlworld.com>
    Re: Newbie regular expression problem (Tad McClellan)
    Re: Newbie regular expression problem <jjgreenaway@no.junk.please.ntlworld.com>
        Newsletter System <hermann_fass@hotmail.com>
    Re: Newsletter System <pap@sotonians.org.uk>
    Re: Newsletter System <hermann_fass@hotmail.com>
        No 'FrameMaker::FDK' on CPAN? Whre it can be downloaded <prof@beta.math.spbu.ru>
    Re: No 'FrameMaker::FDK' on CPAN? Whre it can be downlo <randy@theory.uwinnipeg.ca>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 04 Jul 2000 05:57:28 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and  the $_
Message-Id: <slrn8m2utv.ce9.bernard.el-hagin@gdndev25.lido-tech>

>Jim Kauzlarich wrote:
>> 
>> Question #1
>> 
>> Ok, I'm sure I've seen it discussed somewhere, but I can't seem to find it.
>> I want to treat a scalar string as an array of characters.  Here is what I
>> have:
>> 
>> @a= ( one, two, three, four, five );
>> 
>> foreach $b (@a) {
>>    foreach ($b) {            # <--  I've tried @b $#b and $b[]
>>       print "$_ + ";
>>    }
>>    print "\n";
>> }
>> 
>> The output I get:
>> 
>> one +
>> two +
>> three +
>> four +
>> five +
>> 
>> The output I WANT:
>> 
>> o + n + e +
>> t + w + o +
>> t + h + r + e + e +
>> f + o + u + r +
>> f + i + v + e +

You got a proper response, but here's a "fun" answer:

#!/usr/bin/perl -w

@a = qw/one two three four five/;
$, = " + ";
$\ = " +\n";
foreach (@a){
	print split //;
}

Bernard
--
perl -wle '$_=q badqm!qcb;for(split ??){++$_;s g1gqq+a+ge;print}'


------------------------------

Date: Thu, 6 Jul 2000 01:19:56 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and  the $_
Message-Id: <srV85.3905$%J6.9725@newsfeed.slurp.net>

Cool!  But I don't understand how:

> @a = qw/one two three four five/;

is preferable to:

@a = (one, two, three, four, five);

Even in Golf it's two more strokes.  (Though it does seem to hint at things,
I can't figure what.)

The rest really does take the spirit of my little project to it's limits
though!






------------------------------

Date: 6 Jul 2000 11:27:25 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and  the $_
Message-Id: <8k1qet$rq8$1@nntp9.atl.mindspring.net>

Jim Kauzlarich (o1technospam@skyenet.nospam.net) wrote:
: Cool!  But I don't understand how:
: 
: > @a = qw/one two three four five/;
: 
: is preferable to:
: 
: @a = (one, two, three, four, five);
: 
: Even in Golf it's two more strokes.  (Though it does seem to hint at things,
: I can't figure what.)

The problem is that the two forms aren't equivalent if any of the 
barewords used happen to be the names of perl built-in functions or 
declared subs.



------------------------------

Date: Thu, 06 Jul 2000 14:21:23 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and  the $_
Message-Id: <7a4s63wg17.fsf@merlin.hyperchip.com>


"Jim Kauzlarich" <o1technospam@skyenet.nospam.net> writes:

> Cool!  But I don't understand how:
> 
> > @a = qw/one two three four five/;
> 
> is preferable to:
> 
> @a = (one, two, three, four, five);
> 
> Even in Golf it's two more strokes.  (Though it does seem to hint at things,
> I can't figure what.)

Not really. You add the 'qw', but you also get rid of the commas between
the elements. So, depending on the number of elements in your array (and
hence the number of commas), you can emerge victoriously at the next
Perl Golf tournament :)

Other than that, the second form will fail under strict, while the first
won't. Also, if one of the elements happens to be a Perl built-in
function, the second form will actually execute it.

--Ala


------------------------------

Date: Thu, 6 Jul 2000 23:32:12 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and  the $_
Message-Id: <rYc95.5771$%J6.13092@newsfeed.slurp.net>


"Ala Qumsieh" <aqumsieh@hyperchip.com> wrote in message
news:7a4s63wg17.fsf@merlin.hyperchip.com...
>
> "Jim Kauzlarich" <o1technospam@skyenet.nospam.net> writes:
>
> > Cool!  But I don't understand how:
> >
> > > @a = qw/one two three four five/;
> >
> > is preferable to:
> >
> > @a = (one, two, three, four, five);
> >
> > Even in Golf it's two more strokes.  (Though it does seem to hint at
things,
> > I can't figure what.)
>
> Not really. You add the 'qw', but you also get rid of the commas between
> the elements. So, depending on the number of elements in your array (and
> hence the number of commas), you can emerge victoriously at the next
> Perl Golf tournament :)

Ooop!  Even after it was pointed out that if some of my elements were the
names of built in functions I'd get in trouble, I SILL didn't notice that
the commas were gone!!  (Damn!  I knew there was a reason that mom always
told me to keep my glasses clean!)  :-)

>
> Other than that, the second form will fail under strict, while the first
> won't. Also, if one of the elements happens to be a Perl built-in
> function, the second form will actually execute it.

I'm over here.  Standing corrected.  :-P

JMK




------------------------------

Date: Tue, 04 Jul 2000 14:06:16 +0900
From: Yongsik Kim <yosikim@lgeds.lg.co.kr>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and  the $_
Message-Id: <396170C8.8021A3E@lgeds.lg.co.kr>

foreach (@a) {
   foreach ( split(//,$_) ) {
      print "$_ + ";
   }
   print "\n";
}

Jim Kauzlarich wrote:
> 
> Question #1
> 
> Ok, I'm sure I've seen it discussed somewhere, but I can't seem to find it.
> I want to treat a scalar string as an array of characters.  Here is what I
> have:
> 
> @a= ( one, two, three, four, five );
> 
> foreach $b (@a) {
>    foreach ($b) {            # <--  I've tried @b $#b and $b[]
>       print "$_ + ";
>    }
>    print "\n";
> }
> 
> The output I get:
> 
> one +
> two +
> three +
> four +
> five +
> 
> The output I WANT:
> 
> o + n + e +
> t + w + o +
> t + h + r + e + e +
> f + o + u + r +
> f + i + v + e +
> 
> ====================================
> 
> Question #2 (sort of)
> 
> What I REALLY started this lil project to do was to see if I could nest the
> $_  like this:
> 
> foreach (@a) {
>    foreach ($_) {
>       print "$_ + ";
>    }
>    print "\n";
> }
> 
> Is something like that possible?  (IE is the $_ REALLY special?  Or does it
> act like every other varaible?)
> 
> TIA


------------------------------

Date: Mon, 3 Jul 2000 23:49:33 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <HWd85.417$%J6.2360@newsfeed.slurp.net>

Question #1

Ok, I'm sure I've seen it discussed somewhere, but I can't seem to find it.
I want to treat a scalar string as an array of characters.  Here is what I
have:

@a= ( one, two, three, four, five );

foreach $b (@a) {
   foreach ($b) {            # <--  I've tried @b $#b and $b[]
      print "$_ + ";
   }
   print "\n";
}

The output I get:

one +
two +
three +
four +
five +

The output I WANT:

o + n + e +
t + w + o +
t + h + r + e + e +
f + o + u + r +
f + i + v + e +

====================================

Question #2 (sort of)

What I REALLY started this lil project to do was to see if I could nest the
$_  like this:

foreach (@a) {
   foreach ($_) {
      print "$_ + ";
   }
   print "\n";
}

Is something like that possible?  (IE is the $_ REALLY special?  Or does it
act like every other varaible?)

TIA







------------------------------

Date: Tue, 04 Jul 2000 00:58:51 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <48E98A096B4641BB.61856F63A7A74E2C.38350AD1F7962D59@lp.airnews.net>

On Mon, 3 Jul 2000 23:49:33 -0500, someone claiming to be "Jim
Kauzlarich" <o1technospam@skyenet.nospam.net> said:

>Question #1

>Ok, I'm sure I've seen it discussed somewhere, but I can't seem to find it.
>I want to treat a scalar string as an array of characters.  Here is what I
>have:

>@a= ( one, two, three, four, five );

you need to use qw or put quotes around those words -- -w would have
warned you about that

>foreach $b (@a) {
>   foreach ($b) {            # <--  I've tried @b $#b and $b[]

the reason that didn't do what you wanted it to do is because you're
not telling it to do what you wanted it to do.  your first $b grabs
one element out of @a - your second "foreach ($b)" doesn't make any
sense, because there's only one $b at that point in the script - $b
isn't an array of characters.  if you wanted an array of characters,
you'd need to do a split like
@b = split(//,$b)  and then run a foreach on @b, but that seems like
overkill to me.

>      print "$_ + ";
>   }
>   print "\n";
>}


#!perl -w
@a= qw(one two three four five);
foreach  (@a) {
	s/(\w)/$1 \+ /g; 	# probably a better way to do this, 
			# but I'm just a beginner too :)
	print "$_ \n";
}


Nnickee



------------------------------

Date: 4 Jul 2000 06:10:53 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <8jrv5c$15knk$8@ID-24002.news.cis.dfn.de>

hi,
Jim Kauzlarich <o1technospam@skyenet.nospam.net> wrote:

> I want to treat a scalar string as an array of characters.  Here is what I
> have:

> @a= ( one, two, three, four, five );

that's bad. you are using barewords. try to imagine
what happens if you are doing this with month
names:
@a = (..., jul, aug, sep, oct, ...);
perl would think oct is the function oct()!
better write the words in '' or use
@a= qw( one two three four five );

look at
perldoc perlop
(quote-like operators)

> foreach $b (@a) {
>    foreach ($b) {            # <--  I've tried @b $#b and $b[]
>       print "$_ + ";
>    }
>    print "\n";
> }

well, you got the solution in the other posting...

> Question #2 (sort of)

> What I REALLY started this lil project to do was to see if I could nest the
> $_  like this:

> foreach (@a) {
>    foreach ($_) {
>       print "$_ + ";
>    }
>    print "\n";
> }

> Is something like that possible?  (IE is the $_ REALLY special?  Or does it
> act like every other varaible?)

it is possible. you can try it out. perl uses the
innermost $_ in every scope.


regards,
tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."


------------------------------

Date: Tue, 04 Jul 2000 14:12:16 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <7avgym3ry5.fsf@merlin.hyperchip.com>


"Jim Kauzlarich" <o1technospam@skyenet.nospam.net> writes:

> Question #1

You got enough responses on this one.

> Question #2 (sort of)
> 
> What I REALLY started this lil project to do was to see if I could nest the
> $_  like this:
> 
> foreach (@a) {
>    foreach ($_) {
>       print "$_ + ";
>    }
>    print "\n";
> }
> 
> Is something like that possible?  (IE is the $_ REALLY special?  Or does it
> act like every other varaible?)

Yes, it is possible. And yes, it is special in a foreach() loop. The
foreach() loop localizes the $_ variable so that any changes made to $_
are only visible in that scope. Check this out:

	% perl -wl
	$_ = 'Hello there';
	foreach (qw/1 2/) {
		print "IN  \$_ = $_.";
	}
	print "OUT \$_ = $_.";
	__END__
	IN  $_ = 1.
	IN  $_ = 2.
	OUT $_ = Hello there.

So as soon as you leave the foreach() loop, $_ regains its previous
state. Thus, nesting foreach() loops that use the same variable $_ will
cause each loop to see it's own version of $_ independent of any
other. My only concern about doing this is the possiblity of you
confusing yourself (as I have indeed done several time :)

--Ala


------------------------------

Date: Wed, 05 Jul 2000 22:20:38 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <sm7d5mapgas29@corp.supernews.com>

Jim Kauzlarich (o1technospam@skyenet.nospam.net) wrote:
: Question #1

From now on, one question per post, please, with an appropriate subject
line for each.  Makes them easier to deal with.

: Ok, I'm sure I've seen it discussed somewhere, but I can't seem to find it.
: I want to treat a scalar string as an array of characters.  Here is what I
: have:
: 
: @a= ( one, two, three, four, five );

If you were running with -w, which all non-masochists do, you'd be warned
about those barewords.  Either quote the elements, or use qw().

: foreach $b (@a) {
:    foreach ($b) {            # <--  I've tried @b $#b and $b[]

One way is to replace the line above with

     foreach (split //, $b) {

Split on a null pattern breaks the line into its component characters.

[big snip]
:(IE is the $_ REALLY special?  Or does it
: act like every other varaible?)

More the latter, but with some useful implicit behaviors connected to
looping (among other things).  $_ gets localized to each loop.  So, for
example:

  foreach (qw(a b c)) {
    print"Before: $_\n";

    foreach (qw(1 2 3)) {
      print " $_ +";
    }

    print "\nAfter: $_\n";
  }

Output:

Before: a
 1 + 2 + 3 +
After: a
Before: b
 1 + 2 + 3 +
After: b
Before: c
 1 + 2 + 3 +
After: c

Notice how the 'outer' value of $_ survives being apparently overwritten
by the inner loop.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


------------------------------

Date: Thu, 6 Jul 2000 01:12:52 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <QkV85.3902$%J6.9173@newsfeed.slurp.net>

"Yongsik Kim" <yosikim@lgeds.lg.co.kr> wrote in message
news:396170C8.8021A3E@lgeds.lg.co.kr...
> foreach (@a) {
>    foreach ( split(//,$_) ) {
>       print "$_ + ";
>    }
>    print "\n";
> }

Yes!  Thank you muchly.  This does exactly what I want.  And answers both
questions.

JMK




------------------------------

Date: Thu, 6 Jul 2000 01:29:40 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <BAV85.3907$%J6.9946@newsfeed.slurp.net>

"Tina Mueller" <tina@streetmail.com> wrote in message
news:8jrv5c$15knk$8@ID-24002.news.cis.dfn.de...
> hi,
Howdy

> > @a= ( one, two, three, four, five );
>
> that's bad. you are using barewords. try to imagine
> what happens if you are doing this with month
> names:
> @a = (..., jul, aug, sep, oct, ...);
> perl would think oct is the function oct()!
> better write the words in '' or use
> @a= qw( one two three four five );

Ah.  That answers my question to Bernard.

> it is possible. you can try it out. perl uses the
> innermost $_ in every scope.

Yup.  I did.  It did.  I am happy!  ^_^






------------------------------

Date: Thu, 6 Jul 2000 01:47:38 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <rRV85.3913$%J6.9391@newsfeed.slurp.net>


"Ala Qumsieh" <aqumsieh@hyperchip.com> wrote in message
news:7avgym3ry5.fsf@merlin.hyperchip.com...
>Check this out:
>
> % perl -wl
> $_ = 'Hello there';
> foreach (qw/1 2/) {
> print "IN  \$_ = $_.";
> }
> print "OUT \$_ = $_.";
> __END__
> IN  $_ = 1.
> IN  $_ = 2.
> OUT $_ = Hello there.
>

Hmmm.   I'm missing something here.  When I try to run this I get a "Can't
modify subtraction in scalar assignment at temp2.cgi line 7, near "'Hello
there';" "

> So as soon as you leave the foreach() loop, $_ regains its previous
> state. Thus, nesting foreach() loops that use the same variable $_ will
> cause each loop to see it's own version of $_ independent of any
> other. My only concern about doing this is the possiblity of you
> confusing yourself (as I have indeed done several time :)

8-]]

JMK




------------------------------

Date: Thu, 06 Jul 2000 15:23:59 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <7a1z17waby.fsf@merlin.hyperchip.com>


"Jim Kauzlarich" <o1technospam@skyenet.nospam.net> writes:

> "Ala Qumsieh" <aqumsieh@hyperchip.com> wrote in message
> news:7avgym3ry5.fsf@merlin.hyperchip.com...
> >Check this out:
> >
> > % perl -wl
> > $_ = 'Hello there';
> > foreach (qw/1 2/) {
> > print "IN  \$_ = $_.";
> > }
> > print "OUT \$_ = $_.";
> > __END__
> > IN  $_ = 1.
> > IN  $_ = 2.
> > OUT $_ = Hello there.
> >
> 
> Hmmm.   I'm missing something here.  When I try to run this I get a "Can't
> modify subtraction in scalar assignment at temp2.cgi line 7, near "'Hello
> there';" "

Hmmm .. the whole script is just 5 lines long! Perhaps you included the
first line above '% perl -wl' in your script. Don't do that. This is
just to show that this is to be run from the command line. Remove is
from your script and try again.

--Ala


------------------------------

Date: Thu, 6 Jul 2000 23:38:45 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: Newbie questions: treating a scalar string as an array of chars, and the $_
Message-Id: <B2d95.5806$%J6.11930@newsfeed.slurp.net>


"Ala Qumsieh" <aqumsieh@hyperchip.com> wrote in message
news:7a1z17waby.fsf@merlin.hyperchip.com...
>
> Hmmm .. the whole script is just 5 lines long! Perhaps you included the
> first line above '% perl -wl' in your script. Don't do that. This is
> just to show that this is to be run from the command line. Remove is
> from your script and try again.
>
> --Ala

Duh-Oh!  I warned you I was a newbie!

> > > $_ = 'Hello there';
> > > foreach (qw/1 2/) {
> > > print "IN  \$_ = $_.";
> > > }
> > > print "OUT \$_ = $_.";
> > > __END__
> > > IN  $_ = 1.
> > > IN  $_ = 2.
> > > OUT $_ = Hello there.

Sweet.  It goes even further in my little experiment.

I was thrown by your format.  It didn't really make sence to me, and since I
didn't see anything that looked dangerous to me I just cut an pasted.  Now
that you pointed it out, the whole thing makes sence.

JMK




------------------------------

Date: Wed, 5 Jul 2000 15:46:56 +0100
From: "JJ" <jjgreenaway@no.junk.please.ntlworld.com>
Subject: Newbie regular expression problem
Message-Id: <XSH85.422$_O.7817@news2-win.server.ntlworld.com>

Hi,
You seem quite friendly round here so I wondered if someone could help
here...

I've got a text file with lines such as:

Try {Home http://www.perl.com} or {Home http://www.perl.org}

I want to strip out the { and } characters when they surround web addresses
as above. They occur elsewhere in the text so I cannot just delete every
occurrence.

I've tried using
s/ \{(.*:\/\/.*)\} / $1 /

So the '://' part identifies a web address. But this seems to match the
first { on a line with the last }- not what I'm after. I assume I need to
change the .* parts to something more selective?

Any advice gratefully received,
JJ






------------------------------

Date: Wed, 5 Jul 2000 10:54:36 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie regular expression problem
Message-Id: <slrn8m6j1c.h0p.tadmc@magna.metronet.com>

On Wed, 5 Jul 2000 15:46:56 +0100, JJ <jjgreenaway@no.junk.please.ntlworld.com> wrote:

>You seem quite friendly round here


Can we quote you on that?

:-)


>I've got a text file with lines such as:
>
>Try {Home http://www.perl.com} or {Home http://www.perl.org}


Your lines are _not_ like that.

If they were, you would not be having the problem you describe
below, because your pattern requires a space char following the
} char, and the line above does not have a space after the
second } char, and so cannot match at all.

Please take a little more care when crafting your problem statement.

In fact, just saying the above in Perl instead of in English
would have avoided that problem (and other potential
ambiguities too):


   I've got a text file with lines such as:

   $_ = "Try {Home http://www.perl.com} or {Home http://www.perl.org} \n";


>I want to strip out the { and } characters when they surround web addresses
>as above. They occur elsewhere in the text so I cannot just delete every
>occurrence.
>
>I've tried using
>s/ \{(.*:\/\/.*)\} / $1 /
>
>So the '://' part identifies a web address. 


I expect you could really be requiring at least one char on
either side of that?

   s/ \{(.+:\/\/.+)\} / $1 /;
            ^ ^
            ^ ^

And let's lose the Leaning Toothpick Syndrome by using
an alternate pattern delimiter:

   s# \{(.+://.+)\} # $1 #;
      ^          ^
      ^          ^

And let's also lose the Backslashes That Don't Do Anything:

   s# {(.+://.+)} # $1 #;

>But this seems to match the
>first { on a line with the last }- not what I'm after. I assume I need to
>change the .* parts to something more selective?
                                  ^^^^^^^^^^^^^^

You can (not "need") change the .* parts ( .+ now) to something
"less greedy"  :-)

Appending a ? to the quantifier makes it non-greedy:

   s# {(.+?://.+?)} # $1 #;
          ^     ^

but you probably want both {pairs} stripped?

   s# {(.+?://.+?)} # $1 #g;
                          ^


But, in your particular case above, you can get it done
without non-greedy quantifiers (assuming you cannot have
nested curly braces):

   s# {([^:]+://[^}]+)} # $1 #g;


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Wed, 5 Jul 2000 21:27:03 +0100
From: "JJ" <jjgreenaway@no.junk.please.ntlworld.com>
Subject: Re: Newbie regular expression problem
Message-Id: <yQM85.852$_O.19010@news2-win.server.ntlworld.com>

Blimey. That was fast. Thanks for the help. It was the non-greedy '?' that I
needed.

Cheers,
JJ




------------------------------

Date: Mon, 10 Jul 2000 12:51:17 +0200
From: Hermann Fass <hermann_fass@hotmail.com>
Subject: Newsletter System
Message-Id: <3969AAA5.2348525D@hotmail.com>

I need some sort of newsletter-system to which people can
subscribe to and get informed via email with or without
attachments. Basically no problem, but, assuming ten-thousands
of registrants, I am looking for the best way to do this.

- Automizing subscription (ok, a CGI can put them on a long
  text list, no problem)
- Automizing "remove me from the list
  (if a user is online, he can of course click a link to a CGI
  at the bottom of the email to get removed, but processing
  a "remove me"-email would be far more elegant)
- handling bounced email or removing unavailable users
  automatically or so.

Majordomo etc. can possibly do this, but aren't they an overkill?
Did anybody set up a newletter with an out-of-the-box tool?
Any hints?

Hermann


------------------------------

Date: Mon, 10 Jul 2000 12:03:12 +0000
From: "Paul Taylor" <pap@sotonians.org.uk>
Subject: Re: Newsletter System
Message-Id: <I6ia5.1854$6W.299154@nnrp4.clara.net>

In article <3969AAA5.2348525D@hotmail.com>, Hermann Fass
<hermann_fass@hotmail.com> wrote:
> I need some sort of newsletter-system to which people can subscribe to
> and get informed via email with or without attachments. Basically no
> problem, but, assuming ten-thousands of registrants, I am looking for
> the best way to do this.
> 
> - Automizing subscription (ok, a CGI can put them on a long
>   text list, no problem)
> - Automizing "remove me from the list
>   (if a user is online, he can of course click a link to a CGI
>   at the bottom of the email to get removed, but processing a "remove
>   me"-email would be far more elegant)
> - handling bounced email or removing unavailable users
>   automatically or so.
> 
> Majordomo etc. can possibly do this, but aren't they an overkill? Did
> anybody set up a newletter with an out-of-the-box tool? Any hints?

And Perl would figure *where* in this post?  This newsgroup is intended
for the discussion of Perl issues.  Your post is related only by loose
inference to the topic matter.

Check out http://www.cgi-resources.com - they may have something for
you already.

Pap.



------------------------------

Date: Mon, 10 Jul 2000 13:59:52 +0200
From: Hermann Fass <hermann_fass@hotmail.com>
Subject: Re: Newsletter System
Message-Id: <3969BAB8.39C50571@hotmail.com>

Paul Taylor wrote:
> 
> In article <3969AAA5.2348525D@hotmail.com>, Hermann Fass
> <hermann_fass@hotmail.com> wrote:
> > I need some sort of newsletter-system to which people can subscribe to
> > and get informed via email with or without attachments.
[snip]

> And Perl would figure *where* in this post?  This newsgroup is intended
> for the discussion of Perl issues.  Your post is related only by loose
> inference to the topic matter.
> 
> Check out http://www.cgi-resources.com - they may have something for
> you already.
> 
> Pap.

Thank you very much for the hint and sorry if appearing to be
in the wrong newsgoup ... but for me it seems to be a pure Perl-project
(Majordomo for example is written in Perl as well)


------------------------------

Date: Sat, 8 Jul 2000 15:49:26 +0400
From: "Oleg A. Paraschenko" <prof@beta.math.spbu.ru>
Subject: No 'FrameMaker::FDK' on CPAN? Whre it can be downloaded?
Message-Id: <8k74d9$314q$1@news.spbu.ru>

  Hello!

  Recently I tried to download 'FrameMaker::FDK' from CPAN. But there is no
such module here. Exploring CPAN I founded a page:
http://search.cpan.org/Catalog/String_Language_Text_Processing
with reference to modules:
 ...
FrameMaker - Top level FrameMaker interface
FrameMaker::FDK - Interface to Adobe FDK
 ...
Corresponding links
http://search.cpan.org/search?module=FrameMaker
http://search.cpan.org/search?module=FrameMaker::FDK
returns 'module not found'.


  Could you please suggest where I can download these modules?

----
Oleg





------------------------------

Date: Sat, 8 Jul 2000 13:55:43 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: No 'FrameMaker::FDK' on CPAN? Whre it can be downloaded?
Message-Id: <8k7tk9$h1i$1@canopus.cc.umanitoba.ca>


Oleg A. Paraschenko <prof@beta.math.spbu.ru>
   wrote in message news:8k74d9$314q$1@news.spbu.ru...

>   Recently I tried to download 'FrameMaker::FDK' from CPAN. But there is
no
> such module here. Exploring CPAN I founded a page:
> http://search.cpan.org/Catalog/String_Language_Text_Processing
> with reference to modules:
> FrameMaker - Top level FrameMaker interface
> FrameMaker::FDK - Interface to Adobe FDK
> Corresponding links
> http://search.cpan.org/search?module=FrameMaker
> http://search.cpan.org/search?module=FrameMaker::FDK
> returns 'module not found'.

At http://www.perl.com/CPAN-local/modules/00modlist.long.html
there is a list of modules with the corresponding
DSLI (development,support,language,interface)
information. The FrameMaker modules are listed there,
but the development status is either 'i' or 'c',
meaning an idea or under construction and not yet
released. So they're not yet on CPAN. You might
try contacting the author (CPAN id PEASE) to
see the status of these modules.

best regards,
randy kobes





------------------------------

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 3585
**************************************


home help back first fref pref prev next nref lref last post