[29464] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 708 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 1 18:10:13 2007

Date: Wed, 1 Aug 2007 15:09:06 -0700 (PDT)
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, 1 Aug 2007     Volume: 11 Number: 708

Today's topics:
        if kill 9, $pid fails, is the error caught anywhere? <simon.chao@fmr.com>
    Re: if kill 9, $pid fails, is the error caught anywhere <simon.chao@fmr.com>
    Re: if kill 9, $pid fails, is the error caught anywhere <1usa@llenroc.ude.invalid>
    Re: if kill 9, $pid fails, is the error caught anywhere <mritty@gmail.com>
    Re: if kill 9, $pid fails, is the error caught anywhere xhoster@gmail.com
    Re: if kill 9, $pid fails, is the error caught anywhere <simon.chao@fmr.com>
    Re: if kill 9, $pid fails, is the error caught anywhere <simon.chao@fmr.com>
    Re: if kill 9, $pid fails, is the error caught anywhere xhoster@gmail.com
    Re: IPC::open3: What goes wrong? <bew_ba@gmx.net>
        Perl and Sockets <ZevGreenblatt@gmail.com>
    Re: Perl and Sockets xhoster@gmail.com
        Posting to https  jackson_samson@HOTMAIL.COM
    Re: Posting to https <stephen.odonnell@gmail.com>
    Re: Posting to https  jackson_samson@HOTMAIL.COM
    Re: Prototypes/Parameters to a Function/Sub-Routine <bik.mido@tiscalinet.it>
    Re: Prototypes/Parameters to a Function/Sub-Routine <mritty@gmail.com>
    Re: Prototypes/Parameters to a Function/Sub-Routine <attn.steven.kuo@gmail.com>
    Re: threads and logfile rotation <ThomasKratz@REMOVEwebCAPS.de>
        Using split to count matches, but exclude certain patte  surfitupdotcom@gmail.com
    Re: Using split to count matches, but exclude certain p <mritty@gmail.com>
    Re: Using split to count matches, but exclude certain p <mritty@gmail.com>
    Re: Using split to count matches, but exclude certain p  surfitupdotcom@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 01 Aug 2007 11:45:51 -0700
From:  it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1185993951.400313.206600@w3g2000hsg.googlegroups.com>

in '$!' or '$?' perhaps? I couldn't find it in the perldocs.

Thanks in advance for any assistance.



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

Date: Wed, 01 Aug 2007 11:48:50 -0700
From:  it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1185994130.562023.205630@l70g2000hse.googlegroups.com>

On Aug 1, 2:45 pm, it_says_BALLS_on_your forehead <simon.c...@fmr.com>
wrote:
> in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
>
> Thanks in advance for any assistance.

nvm, i gather it's in '$!'. On another note, does anyone know of any
reason besides 'No such process' that would lead to a return of 0 from
the kill function? trying to come up with actionable instructions for
support team.



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

Date: Wed, 01 Aug 2007 19:09:10 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <Xns997F9A2BDFD20asu1cornelledu@127.0.0.1>

it_says_BALLS_on_your forehead <simon.chao@fmr.com> wrote in 
news:1185993951.400313.206600@w3g2000hsg.googlegroups.com:

> in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
> 
> Thanks in advance for any assistance.

perldoc perlipc

'Signals' has some information.

When directed at a process whose UID is not identical to that of the
sending process, signal number zero may fail because you lack permission
to send the signal, even though the process is alive. You may be able to
determine the cause of failure using "%!".

    unless (kill 0 => $pid or $!{EPERM}) {
        warn "$pid looks dead";
    }

 ...

For more complex signal handling, you might see the standard POSIX
module. Lamentably, this is almost entirely undocumented, but the
t/lib/posix.t file from the Perl source distribution has some examples
in it.

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Wed, 01 Aug 2007 12:18:30 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1185995910.284585.31090@g4g2000hsf.googlegroups.com>

On Aug 1, 2:48 pm, it_says_BALLS_on_your forehead <simon.c...@fmr.com>
wrote:
> does anyone know of any
> reason besides 'No such process' that would lead to a return of 0 from
> the kill function? trying to come up with actionable instructions for
> support team.

Well the obvious answer is that the current user lacks permissions to
send a signal to a given process.  Not just anyone can send a signal
to any given process.

Paul Lalli




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

Date: 01 Aug 2007 19:41:30 GMT
From: xhoster@gmail.com
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <20070801154132.728$9A@newsreader.com>

it_says_BALLS_on_your forehead <simon.chao@fmr.com> wrote:
> On Aug 1, 2:45 pm, it_says_BALLS_on_your forehead <simon.c...@fmr.com>
> wrote:
> > in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
> >
> > Thanks in advance for any assistance.
>
> nvm, i gather it's in '$!'. On another note, does anyone know of any
> reason besides 'No such process' that would lead to a return of 0 from
> the kill function?

Sure.  Trying to kill processes you don't own.  (Unless you are root)

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Wed, 01 Aug 2007 13:25:08 -0700
From:  it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1185999908.664552.40330@22g2000hsm.googlegroups.com>

On Aug 1, 3:41 pm, xhos...@gmail.com wrote:
> it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote:
> > On Aug 1, 2:45 pm, it_says_BALLS_on_your forehead <simon.c...@fmr.com>
> > wrote:
> > > in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
>
> > > Thanks in advance for any assistance.
>
> > nvm, i gather it's in '$!'. On another note, does anyone know of any
> > reason besides 'No such process' that would lead to a return of 0 from
> > the kill function?
>
> Sure.  Trying to kill processes you don't own.  (Unless you are root)

Ahh, didn't think about that. Thanks!



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

Date: Wed, 01 Aug 2007 13:26:04 -0700
From:  it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1185999964.801983.125700@d55g2000hsg.googlegroups.com>

On Aug 1, 3:09 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote innews:1185993951.400313.206600@w3g2000hsg.googlegroups.com:
>
> > in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
>
> > Thanks in advance for any assistance.
>
> perldoc perlipc
>
> 'Signals' has some information.
>
> When directed at a process whose UID is not identical to that of the
> sending process, signal number zero may fail because you lack permission
> to send the signal, even though the process is alive. You may be able to
> determine the cause of failure using "%!".

did you really mean "%!"? or did you mean "$!"?



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

Date: 01 Aug 2007 21:22:53 GMT
From: xhoster@gmail.com
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <20070801172255.754$rN@newsreader.com>

it_says_BALLS_on_your forehead <simon.chao@fmr.com> wrote:
> On Aug 1, 3:09 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> > it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote
> > innews:1185993951.400313.206600@w3g2000hsg.googlegroups.com:
> >
> > > in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
> >
> > > Thanks in advance for any assistance.
> >
> > perldoc perlipc
> >
> > 'Signals' has some information.
> >
> > When directed at a process whose UID is not identical to that of the
> > sending process, signal number zero may fail because you lack
> > permission to send the signal, even though the process is alive. You
> > may be able to determine the cause of failure using "%!".
>
> did you really mean "%!"? or did you mean "$!"?

I think he really meant %!.  Read the perldoc perlvar entry for it.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Wed, 01 Aug 2007 11:19:55 -0700
From:  bernd <bew_ba@gmx.net>
Subject: Re: IPC::open3: What goes wrong?
Message-Id: <1185992395.757263.149300@w3g2000hsg.googlegroups.com>

On Aug 1, 7:19 pm, Brian McCauley <nobul...@gmail.com> wrote:
> On Aug 1, 6:05 pm, bernd <bew...@gmx.net> wrote:
>
>
>
> > open3 (\*WRT, \*OUT, \*ERR, "ls -ly ; echo $?")
> > On the command line "ls -ly" has the return code 2, run from within
> > perl I get 0.
>
> > What goes wrong?
>
> You have the wrong type of quotes in Perl.
>
> The Unix command you are actually executing is
>
> ls -ly ; echo 0

Oops, yes, You are right. Thanx!



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

Date: Wed, 01 Aug 2007 20:05:47 -0000
From:  "Zev G." <ZevGreenblatt@gmail.com>
Subject: Perl and Sockets
Message-Id: <1185998747.353636.141160@k79g2000hse.googlegroups.com>

Hi

I am working on a new project and the need to code in Sockets came up.
I have also been told that the nature of sockets entails multi-
threading. In other words, if my program is listening for a call, I
need to make sure the user can use the computer for other stuff.   I
have never done either of them. Someone refered me to Perl which I
have not used since college. I understand Perl is easy to brush up on
and pick up and it has a wrapper for sockets. Does this wrapper also
handle the threads? Will using Perl for sockets entail a much shorter
learning curve that something like, say, VB.

Thank you in advance. Any help would be apprecisted.

Zev



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

Date: 01 Aug 2007 22:06:38 GMT
From: xhoster@gmail.com
Subject: Re: Perl and Sockets
Message-Id: <20070801180641.222$8x@newsreader.com>

"Zev G." <ZevGreenblatt@gmail.com> wrote:
> Hi
>
> I am working on a new project and the need to code in Sockets came up.
> I have also been told that the nature of sockets entails multi-
> threading. In other words, if my program is listening for a call, I
> need to make sure the user can use the computer for other stuff.

Pretty much any modern general-purpose OS these days is multi-tasking,
so using the computer for other stuff is not a problem.  Using the
same *program instance* for other stuff could be, though.  Is that what
you meant?

If so, you don't necessarily need threads to do that.  You can use
IO::Select or nonblocking IO instead.

> I
> have never done either of them. Someone refered me to Perl which I
> have not used since college. I understand Perl is easy to brush up on
> and pick up and it has a wrapper for sockets. Does this wrapper also
> handle the threads?

In my opinion, Perl threads are not (yet) suitable for serious work.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Wed, 01 Aug 2007 14:36:24 -0700
From:  jackson_samson@HOTMAIL.COM
Subject: Posting to https
Message-Id: <1186004184.493888.45610@57g2000hsv.googlegroups.com>

I am using CGI and have created a html form. When I submit it performs
a POST to a https:// site.  I keep getting a internal server error
(500).

I need to Post to the https. If I post to a http, then it works.

Thanks,



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

Date: Wed, 01 Aug 2007 21:41:06 -0000
From:  Stephen O'D <stephen.odonnell@gmail.com>
Subject: Re: Posting to https
Message-Id: <1186004466.337014.7580@19g2000hsx.googlegroups.com>

On Aug 1, 10:36 pm, jackson_sam...@HOTMAIL.COM wrote:
> I am using CGI and have created a html form. When I submit it performs
> a POST to a https:// site.  I keep getting a internal server error
> (500).
>
> I need to Post to the https. If I post to a http, then it works.
>
> Thanks,

Were going to need more information.  What error appears in your
webserver error log when the 500 response occurs?  Its highly probable
that the https part of your server is configured differently to the
http side hence the error.

Almost certainly a webserver issue and not a Perl one.



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

Date: Wed, 01 Aug 2007 14:47:07 -0700
From:  jackson_samson@HOTMAIL.COM
Subject: Re: Posting to https
Message-Id: <1186004827.043797.267650@w3g2000hsg.googlegroups.com>

On Aug 1, 5:41 pm, Stephen O'D <stephen.odonn...@gmail.com> wrote:
> On Aug 1, 10:36 pm, jackson_sam...@HOTMAIL.COM wrote:
>
> > I am using CGI and have created a html form. When I submit it performs
> > a POST to a https:// site.  I keep getting a internal server error
> > (500).
>
> > I need to Post to the https. If I post to a http, then it works.
>
> > Thanks,
>
> Were going to need more information.  What error appears in your
> webserver error log when the 500 response occurs?  Its highly probable
> that the https part of your server is configured differently to the
> http side hence the error.
>
> Almost certainly a webserver issue and not a Perl one.

Are you saying that the CGI module should let me post directly to an
https site without any problems?

I will check the logs...  I am using IIS 6.0 and posting to another
remote page.  I can create my own html page that posts directly to the
https page without any errors.  Any insight into what I can check on
the IIS web server?  Thanks for your response.




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

Date: Wed, 01 Aug 2007 19:56:45 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Prototypes/Parameters to a Function/Sub-Routine
Message-Id: <l4i1b395eu0ts8a63dq0rgqkjsv2f3imsp@4ax.com>

On Wed, 01 Aug 2007 09:49:14 -0700, Paul Lalli <mritty@gmail.com>
wrote:

>Similarly, you'd probably expect this to return an error that a list
>is required:
>
>$ perl -le'
>sub printArray(@) {
>   my @nums = @_;
>   print for @nums;
>}
>printArray();
>'
>
>But this program executes just fine.  Because an "empty" list is still
>a list.

In fact this is perfectly fine, if you ask me, and not a good example
of prototypes failing. I'm not really sure but I think that even Perl
6's powerful signatures do not provide means to specify that a list to
be passed must have a specific size, or even more simply that it is
non empty.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Wed, 01 Aug 2007 12:19:45 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: Prototypes/Parameters to a Function/Sub-Routine
Message-Id: <1185995985.939911.257810@l70g2000hse.googlegroups.com>

On Aug 1, 1:56 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On Wed, 01 Aug 2007 09:49:14 -0700, Paul Lalli <mri...@gmail.com>
> wrote:
>
> >Similarly, you'd probably expect this to return an error that a list
> >is required:
>
> >$ perl -le'
> >sub printArray(@) {
> >   my @nums = @_;
> >   print for @nums;
> >}
> >printArray();
> >'
>
> >But this program executes just fine.  Because an "empty" list is still
> >a list.
>
> In fact this is perfectly fine, if you ask me, and not a good example
> of prototypes failing.

Perhaps not, but I think it is a decent example of prototypes not
doing what someone new to Perl programming would *expect* them to do.

Paul Lalli



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

Date: Wed, 01 Aug 2007 13:01:37 -0700
From:  "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Prototypes/Parameters to a Function/Sub-Routine
Message-Id: <1185998497.153742.326460@d30g2000prg.googlegroups.com>

On Aug 1, 8:41 am, "O. Olson" <olson_...@yahoo.it> wrote:
> Hi,
>         I would like to know if it is possible to enforce the number and type
> of the parameters in a function prototype. Assuming that a person does
> not circumvent the prototypes using &.
>

Enforce?  No, not really.

>
> This would be of more importance when I am working with Objects i.e.
> to ensure that the reference passed, is an object of a certain class.
>


Perhaps you'll find the Params::Util module from CPAN helpful for
checking parameters.

--
Hope this helps,
Steven





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

Date: Wed, 01 Aug 2007 22:16:46 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: threads and logfile rotation
Message-Id: <46b0ea2d$0$2640$bb690d87@news.main-rheiner.de>

Just for the records:

I finally redesigned the logfile handling so that no rename is needed. I 
just open a logfile with a timestamp in the first place. The first 
thread that discovers that rotation is needed, opens a new file and 
stores the new fileno in a shared var.
When the other threads see the fileno change they simply switch over to 
the new file.

Now reading the latest logfile requires sorting the files by name or 
date, but that is tolerable.

Thomas

-- 
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-


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

Date: Wed, 01 Aug 2007 12:22:26 -0700
From:  surfitupdotcom@gmail.com
Subject: Using split to count matches, but exclude certain patterns
Message-Id: <1185996146.102624.240590@22g2000hsm.googlegroups.com>

I have script that recursively greps for a term and counts the
occurrences of it in each file.  It works fine but now I want to
exclude matches where the term has an underscore in front or after
it.  I have tried to continue using split on (not underscore)
$search_term(not underscore) in below examples but my results are not
right yet.  Input is a string in $grep_out and I want to count any
number of occurrences.  I can not break string up into words since a
correct match may not have spaces or any certain character around it.
Let me know if I have not provided enough info, or should post whole
script....   Thanks in advance for any assist, John

Attempts so far:
#            @surewords = split(/(?<!\_)${search_term}(?!\_)/im,
$grep_out);
#            @surewords = split(/\_{0}${search_term}\_{0}/im,
$grep_out);
            @surewords = split(/[^\_]${search_term}[^\_]/im,
$grep_out);
#            @surewords = split(/(^|[^\_])${search_term}($|[^\_])/im,
$grep_out);



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

Date: Wed, 01 Aug 2007 12:29:50 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: Using split to count matches, but exclude certain patterns
Message-Id: <1185996590.564860.190380@b79g2000hse.googlegroups.com>

On Aug 1, 3:22 pm, surfitupdot...@gmail.com wrote:
> I have script that recursively greps for a term and counts the
> occurrences of it in each file.  It works fine but now I want to
> exclude matches where the term has an underscore in front or after
> it.  I have tried to continue using split on (not underscore)
> $search_term(not underscore) in below examples but my results are not
> right yet.  Input is a string in $grep_out and I want to count any
> number of occurrences.  I can not break string up into words since a
> correct match may not have spaces or any certain character around it.
> Let me know if I have not provided enough info, or should post whole
> script....   Thanks in advance for any assist, John
>
> Attempts so far:
> #            @surewords = split(/(?<!\_)${search_term}(?!\_)/im,
> $grep_out);

_ is not special.  No need to backslash it.   This code says to split
on any $search_term that is not *immediately* preceded by or
*immediately* followed by an underscore.  Is that what you meant?

> #            @surewords = split(/\_{0}${search_term}\_{0}/im,
> $grep_out);

A quantifier of {0} is a no-op.  Frankly, I think that should be a
syntax error, or at least a warning.

>             @surewords = split(/[^\_]${search_term}[^\_]/im,
> $grep_out);

This says to include the not-underscore character in the split
delimiter.

> #            @surewords = split(/(^|[^\_])${search_term}($|[^\_])/im,
> $grep_out);

That's a modification of the above, allowing $search_term to come at
the beginning or end of the string as well.


Please provide some sample input and sample output, so people have a
chance to know what it is you're trying to acheive.   This and other
good advice can be found in the Posting Guidelines, which are posted
here twice a week.

Paul Lali



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

Date: Wed, 01 Aug 2007 12:41:30 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: Using split to count matches, but exclude certain patterns
Message-Id: <1185997290.175317.291270@o61g2000hsh.googlegroups.com>

On Aug 1, 3:22 pm, surfitupdot...@gmail.com wrote:
> I have script that recursively greps for a term and counts the
> occurrences of it in each file.  It works fine but now I want to
> exclude matches where the term has an underscore in front or after
> it.  I have tried to continue using split

As a side note to my other response, split() is a very bad way to
attempt to count occurrences of a string:

$ perl -le'
print scalar(@foo = split /foo/, "barfoobazfoobiff");
print scalar(@foo = split /foo/, "barfoobazbifffoo");
print scalar(@foo = split /foo/, "barbazbifffoofoo");
'
3
2
1


I rather strongly suggest you read:
 $ perldoc -q count
Found in /opt2/Perl5_8_4/lib/perl5/5.8.4/pod/perlfaq4.pod
     How can I count the number of occurrences of a substring
     within a string?

Paul Lalli



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

Date: Wed, 01 Aug 2007 13:02:28 -0700
From:  surfitupdotcom@gmail.com
Subject: Re: Using split to count matches, but exclude certain patterns
Message-Id: <1185998548.311521.16030@o61g2000hsh.googlegroups.com>

On Aug 1, 2:41 pm, Paul Lalli <mri...@gmail.com> wrote:
> On Aug 1, 3:22 pm, surfitupdot...@gmail.com wrote:
>
> > I have script that recursively greps for a term and counts the
> > occurrences of it in each file.  It works fine but now I want to
> > exclude matches where the term has an underscore in front or after
> > it.  I have tried to continue using split
>
> As a side note to my other response, split() is a very bad way to
> attempt to count occurrences of a string:
>
> $ perl -le'
> print scalar(@foo = split /foo/, "barfoobazfoobiff");
> print scalar(@foo = split /foo/, "barfoobazbifffoo");
> print scalar(@foo = split /foo/, "barbazbifffoofoo");
> '
> 3
> 2
> 1
>
> I rather strongly suggest you read:
>  $ perldoc -q count
> Found in /opt2/Perl5_8_4/lib/perl5/5.8.4/pod/perlfaq4.pod
>      How can I count the number of occurrences of a substring
>      within a string?
>
> Paul Lalli

You read me correctly, idea was to split on any occurrence of my
search term that does not have an underscore before or after it.
Counting matches using split worked fine until I tried to exclude
certain patterns.  I will look at the perldoc you suggested but here
is more info for the thread.  Thanks, John

Sample input:   super _super_ _super super SUPER SUPER_  blahsuper
Desired output: super super SUPER super

Current output using split(/(?<!_)${search_term}(?!_)/i, $grep_out);
  Array contents-   _super_ _super     SUPER_ blah




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 708
**************************************


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