[19225] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1420 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 1 06:05:47 2001

Date: Wed, 1 Aug 2001 03:05:09 -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: <996660309-v10-i1420@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 1 Aug 2001     Volume: 10 Number: 1420

Today's topics:
    Re: ####  ADD 6 INCHES TO YOUR PENIS #####  2830 <w@na.com>
    Re: BUG in Perl when using setpgrp... <jasonb@computer.org>
    Re: BUG in Perl when using setpgrp... (Villy Kruse)
        Converting in Image::Magick <sky@mail.lviv.ua>
    Re: Data Interchange Format (Robert Goff)
    Re: Data Interchange Format <jeff@vpservices.com>
    Re: Data Interchange Format <bart.lateur@skynet.be>
    Re: Emal Options Robustness nobull@mail.com
        FAQ: How can I remove duplicate elements from a list or <faq@denver.pm.org>
    Re: FAQ: How do I reformat a paragraph? <goldbb2@earthlink.net>
    Re: FAQ: What is the difference between $array[1] and @ <mischief@velma.motion.net>
    Re: FAQ: What is the difference between $array[1] and @ <bill.kemp@wire2.com>
    Re: Finding "this" but not "this and that" with a regex <godzilla@stomp.stomp.tokyo>
    Re: Flock on DATA? (Anno Siegel)
    Re: Having some trouble with map (John Joseph Trammell)
    Re: Having some trouble with map <bart.lateur@skynet.be>
    Re: Help with an array and foreach nobull@mail.com
    Re: join lines ? (Tim)
        mod_perl php4 DBI->connect MySQL bomb segfault solved. ard@waikato.ac.nz
    Re: perlbug: blacklisted as a spam haven (Villy Kruse)
        RegExp (Gerfried Ranner)
        Regular Expression:  Remove Double Letters from a Strin <sped@mailandnews.com>
    Re: Regular Expression:  Remove Double Letters from a S <uri@sysarch.com>
    Re: Regular Expression:  Remove Double Letters from a S <monty@primenet.com>
    Re: Regular Expression:  Remove Double Letters from a S (Mark Jason Dominus)
    Re: Regular Expression:  Remove Double Letters from a S <rhavu@csc.fi>
    Re: Reporting Questionable Programming Activity  <wyzelli@yahoo.com>
        sending email problems in CGI <txarli@txarli.com>
    Re: simple IO::Select problem on Win32 nobull@mail.com
    Re: Strange problem... nobull@mail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 01 Aug 2001 04:07:58 GMT
From: W <w@na.com>
Subject: Re: ####  ADD 6 INCHES TO YOUR PENIS #####  2830
Message-Id: <3B67811F.7DDD7BDF@na.com>



Scott Porter wrote:

> On Thu, 19 Jul 2001 14:42:53 -0400, Andras Malatinszky <andras@mortgagestats.com>
> wrote:
>
> >
> >
> >Craig Berry wrote:
> >
> >> Bernard El-Hagin (bernard.el-hagin@lido-tech.net) wrote:
> >> : Who needs a module?
> >> :
> >> : $your_cock += 6;
> >>
> >> Yeah, if yours is scalar...
> >>
> >>   push @your_cock, ("inches") x 6;
> >
> >Ouch! That sounds painful!
> >
>
> :-) myCock+=(myCock*.8);

Why would i want an 18 inch cock?



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

Date: Wed, 01 Aug 2001 05:35:35 GMT
From: Jason Boerner <jasonb@computer.org>
Subject: Re: BUG in Perl when using setpgrp...
Message-Id: <3B67952D.8030904@computer.org>

The Camel book calls this the "current process group (pgrp)".  Which is 
different form the "real gid".  What I want to do is run this 
application SGID.  I want to change the GID from the current group to 
group 11 (src).

Think of this as a person doing a newgrp command from the command line 
and then launch an application. Hummm, I guess I could fork as a 
workaround but boy does that get ugly.


Unless I'm completly misreading the camel book, it would seem that 
setpgrp should change the group id from $( to something else (which will 
become $) ).  However, not only is my effective gid not changing but 
getpgrp is not functioning correctly in that it is returning the UID 
instead of the GID.


Christopher Masto wrote:

> In article <3B64AEC0.80307@computer.org>, "Jason Boerner"
> <jasonb@computer.org> wrote:
> 
> 
>>Reading the camel book, "This function returns the current process group
>>for the specified PID (use a PID of 0 for the current process)."
>>
> 
> You have confused "process group" with "GID".  Look at $) in perlvar.
> 
> I don't think you want that either, though.  Based on your "expected
> output", you have probably misunderstood something about Unix semantics.
> Unless it's a Linux weirdism, you don't have an "active group", nor is
> there any reason to change it.
> 




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

Date: 01 Aug 2001 07:38:59 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: BUG in Perl when using setpgrp...
Message-Id: <slrn9mfcgh.9em.vek@pharmnl.ohout.pharmapartners.nl>

On Wed, 01 Aug 2001 05:35:35 GMT,
    Jason Boerner <jasonb@computer.org> wrote:


>The Camel book calls this the "current process group (pgrp)".  Which is 
>different form the "real gid".  What I want to do is run this 
>application SGID.  I want to change the GID from the current group to 
>group 11 (src).
>

The process group is unrelated to the real group id as well as the
effective group id.  

The effective and real group id is set by the variables $) and $(,
which may or may not be modifyable.  Unix usualy restricts what
you can do with the gid values for security reasons.  So what you
need to do is "$) = $(;" and then test the $) variable to see if the
change took effect.  The effective group id is the same as the real
group id unless the executable have the SGID bit set in which case
the effective group id will come from the group of the executable
file.  This may or may not work with perl scripts depending on the
system and the availability of the suidperl program.


The process group is a number assigned to a related group of running
processes and is normaly set by the shell to be the same as the process
id for a process started in background.  Thus is used by the shell
job management to kill all the processes in a job by that process group.



Villy


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

Date: Wed, 01 Aug 2001 11:07:49 +0300
From: Kolorove Nebo <sky@mail.lviv.ua>
Subject: Converting in Image::Magick
Message-Id: <3B67B8D5.D9D1E169@mail.lviv.ua>

I'm using Image::Magick on Win32 platform.
Can anybody point me an exaple of using "convert" command  
in PERL scripts in Win32 distribution.
In my case i got message: could not find convert.al in @INC (there is no
file
with such name at my computer at all, i've cecked it), is it possible
that i have
to load any additional libriaries or programms to use CONVERT.


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

Date: 31 Jul 2001 21:12:18 -0700
From: beast@avalon.albuquerque.nm.us (Robert Goff)
Subject: Re: Data Interchange Format
Message-Id: <55f4cea3.0107312012.f15429c@posting.google.com>

nobull@mail.com wrote in message news:<u9ofq5v7lx.fsf@wcl-l.bham.ac.uk>...

> Is DIF not CSV?  There are modules to handle CSV.

The DIF file that I have, exported from FileMaker Pro, is definitely not CSV.

--
I can't remember if I'm the good twin or the evil one.
======================================================================
Robert Goff                                  http://aisling.cc/resume/
Technical Writer/Editor, Webmaster                        505-564-8959


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

Date: Tue, 31 Jul 2001 22:44:28 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Data Interchange Format
Message-Id: <3B67973C.E387DD42@vpservices.com>

Robert Goff wrote:
> 
> nobull@mail.com wrote in message news:<u9ofq5v7lx.fsf@wcl-l.bham.ac.uk>...
> 
> > Is DIF not CSV?  There are modules to handle CSV.
> 
> The DIF file that I have, exported from FileMaker Pro, is definitely not CSV.

Are you processing on the same platform as FileMaker and, if so, would
it be easier to use DBD::ODBC straight into FileMaker?

-- 
Jeff



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

Date: Wed, 01 Aug 2001 09:57:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Data Interchange Format
Message-Id: <3ckfmt8u0v3uhr8ra1mc7qqp1ltabeoqff@4ax.com>

Robert Goff wrote:

>I've looked and looked, but I haven't found code that will parse a DIF
>file, the DIF that is produced by spreadsheet programs and FileMaker
>Pro, specificially.  Any suggestions?  Thanks.

Write your own DIF parser? You can get info on the file format on
Wotsit, <http://www.wotsit.org/download.asp?f=dif> (2k ZIP file,
containing 6k of text).

Note to Jeff Zucker: perhaps another candidate for DBD::Anydata (former
DBD::RAM)?

-- 
	Bart.


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

Date: 01 Aug 2001 07:45:21 +0100
From: nobull@mail.com
Subject: Re: Emal Options Robustness
Message-Id: <u9u1zs8dr7.fsf@wcl-l.bham.ac.uk>

Paul Johnston <paul.johnston@dsvr.co.uk> writes:

> >  A) Using SMTP to connect directly to the remote MX.
> 
> I wrote some code to do this, as part of a web sign-up form. I wanted
> the page that came back to them to either say "mail successfully
> delivered" or to explain the problem.

Pointless really as the MX host is rarely the final destination.

> If you pass the message off to a
> smarthost - even on on the local machine - you lose the immediate error
> path and rely on bounce messages.

Same applies if you remote MX.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 01 Aug 2001 06:19:53 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How can I remove duplicate elements from a list or array?
Message-Id: <dcN97.28$l_m.193332224@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How can I remove duplicate elements from a list or array?

    There are several possible ways, depending on whether the array is
    ordered and whether you wish to preserve the ordering.

    a)  If @in is sorted, and you want @out to be sorted: (this assumes all
        true values in the array)

            $prev = "not equal to $in[0]";
            @out = grep($_ ne $prev && ($prev = $_, 1), @in);

        This is nice in that it doesn't use much extra memory, simulating
        uniq(1)'s behavior of removing only adjacent duplicates. The ", 1"
        guarantees that the expression is true (so that grep picks it up)
        even if the $_ is 0, "", or undef.

    b)  If you don't know whether @in is sorted:

            undef %saw;
            @out = grep(!$saw{$_}++, @in);

    c)  Like (b), but @in contains only small integers:

            @out = grep(!$saw[$_]++, @in);

    d)  A way to do (b) without any loops or greps:

            undef %saw;
            @saw{@in} = ();
            @out = sort keys %saw;  # remove sort if undesired

    e)  Like (d), but @in contains only small positive integers:

            undef @ary;
            @ary[@in] = @in;
            @out = grep {defined} @ary;

    But perhaps you should have been using a hash all along, eh?

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           04.39
-- 
    This space intentionally left blank


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

Date: Wed, 01 Aug 2001 01:29:27 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: FAQ: How do I reformat a paragraph?
Message-Id: <3B6793B7.14079C72@earthlink.net>

PerlFAQ Server wrote:
> +
>   How do I reformat a paragraph?
> 
>     Use Text::Wrap (part of the standard Perl distribution):
> 
>         use Text::Wrap;
>         print wrap("\t", '  ', @paragraphs);
> 
>     The paragraphs you give to Text::Wrap should not contain embedded
>     newlines. Text::Wrap doesn't justify the lines (flush-right).
> 
> -

IMHO, this FAQ should include a mention of Text::Autoformat.

Formatting files can be easily done by making a shell alias, like so:

alias fmt="perl -i -MText::Autoformat -n0777 \
	-e 'print autoformat $_, {all=>1}' $*"


I wish that autoformat took an 'indent' option, so you could force the
first line of each paragraph to be set in from the rest, but aside from
this one lack, it's a pretty good tool.

-- 
I need more taglines. This one is getting old.


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

Date: Wed, 01 Aug 2001 05:28:04 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: FAQ: What is the difference between $array[1] and @array[1]?
Message-Id: <tmf4r4gdj9o6b1@corp.supernews.com>

PerlFAQ Server <faq@denver.pm.org> wrote:
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with every Standard Distribution of
> Perl.

> +
>   What is the difference between $array[1] and @array[1]?

Could this FAQ snippet ________PLEASE________ be removed from
the autopost rotation? If not now, at least when Perl 6 is
closer to release? Otherwise, I fear a whole bunch of confusion
due to the information listed.

Chris

-- 
Where there's a will, there's a lawyer.



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

Date: Wed, 1 Aug 2001 10:38:57 +0100
From: "W K" <bill.kemp@wire2.com>
Subject: Re: FAQ: What is the difference between $array[1] and @array[1]?
Message-Id: <v9Q97.94$t97.1284@news.uk.colt.net>

>> +
>>   What is the difference between $array[1] and @array[1]?
>
>Could this FAQ snippet ________PLEASE________ be removed from
>the autopost rotation? If not now, at least when Perl 6 is
>closer to release? Otherwise, I fear a whole bunch of confusion
>due to the information listed.


Maybe, but there are still old perl scripts out there that replicate this
mistake, and info on the internet that is extremely out of date.

I have seen it fairly recently from 3 different programmers (some of them
very competant in other languages).

"it works doesn't it"  (not my words)




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

Date: Tue, 31 Jul 2001 22:02:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Finding "this" but not "this and that" with a regex?
Message-Id: <3B678D52.4BE00E1A@stomp.stomp.tokyo>

Jay McGavren wrote:
 
> > Oops; I'm getting this backwards and possibly confusing the hell out
> > of everyone.  What I'm really looking for:
 
> Never mind; I'm the only confused person here.  :)  if ($Record =~
> /this/ && $Record !~ /that/) would indeed be what I need.  Makes you
> wonder if my original logic is as efficient as it could be...
 
A presumption is made you will not change
your parameters for a fourth time.

There is a possibility you are setting yourself
up for some logic flow challenges later. Appears
you want to array loop your "ignore" and "not ignore"
terms for comparison testing, this is, run through
a variety of combinations for your print. This is
difficult to ascertain with your constantly changing
your parameters and, difficult to ascertain based
on translations of others; there is quite a variety.
Additionally, initially you display an array containing
only two terms when no array is needed; two variables
suffice nicely. Later there is discussion of methodology
using two arrays, looping both.

I am not sure what you want and, obviously you are
even more unsure what you want.

Nonetheless, I have elected to exemplify a logic flow
problem created by contrasting using only two variables,
$ignore and $not_ignore, for unique singular testing,
compared to array looping for $ignore and $not_ignore.

A quick glance at my printed results should avail you
an ability to surmise this potential logic flow problem
you may very well create.


Godzilla!
--

TEST SCRIPT:
____________

#!perl

print "Content-type: text/plain\n\n";


@Data = ("godzilla rocks! ignore",
         "godzilla rocks and rolls!",
         "godzilla rocks! ignore", 
         "godzilla rocks! ignore not ignore",
         "godzilla rocks! not ignore",
         "godzilla is a tyrannosaurus.rex",
         "godzilla rocks and rolls lizards");

@Array = ("ignore:not ignore", "rocks:rolls", "godzilla:lizard",);


$ignore = "ignore";
$not_ignore = "not ignore";
print "Variation One:\n\n";
&Variation;


$ignore = "rocks";
$not_ignore = "rolls";
print "\n\nVariation Two:\n\n";
&Variation;


$ignore = "godzilla";
$not_ignore = "lizard";
print "\n\nVariation Three:\n\n";
&Variation;


print "\n\nVariation Four:\n\n";

for (@Array)
 {
  ($ignore, $not_ignore) = split (/:/, $_);
  &Variation;
 }


sub Variation
 {
  for (@Data)
   {
    if ((index ($_, $ignore) > -1) & (index ($_, $not_ignore) > -1))
     { print "$_\n"; }
    elsif ((index ($_, $ignore) > -1) & (index ($_, $not_ignore) == -1))
     { next; }
    else
     { print "$_\n"; }
   }
 }

exit;


PRINTED RESULTS:
________________

Variation One:

godzilla rocks and rolls!
godzilla rocks! ignore not ignore
godzilla rocks! not ignore
godzilla is a tyrannosaurus.rex
godzilla rocks and rolls lizards


Variation Two:

godzilla rocks and rolls!
godzilla is a tyrannosaurus.rex
godzilla rocks and rolls lizards


Variation Three:

godzilla rocks and rolls lizards


Variation Four:

godzilla rocks and rolls!
godzilla rocks! ignore not ignore
godzilla rocks! not ignore
godzilla is a tyrannosaurus.rex
godzilla rocks and rolls lizards
godzilla rocks and rolls!
godzilla is a tyrannosaurus.rex
godzilla rocks and rolls lizards
godzilla rocks and rolls lizards


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

Date: 1 Aug 2001 07:33:22 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Flock on DATA?
Message-Id: <9k8bc2$jnb$1@mamenchi.zrz.TU-Berlin.DE>

According to John Lin <johnlin@chttl.com.tw>:
> "Bart Lateur" wrote
> > Benjamin Goldberg wrote:
> > 
> > >I'm not sure how well this would work, but... if a particular file (say,
> > >a DB file) is only being accessed from one module, could we simply lock
> > >the DATA filehandle within that module, rather than creating something
> > >*just* to be a lockfile?
> > 
> > No. You need write access for an exclusive lock.
> 
> Ho, ho... but I think the OP's idea is interesting.  It could be used in
> main program to avoid multiple executing.  I did an experiment:
> 
> use Fcntl ':flock';
> $| = 1;
> flock(DATA,LOCK_EX|LOCK_NB) or die "$0 is executing\n";
> print sleep 1 for 1..10;
> 
> __DATA__
> 
> Great!!!  When one program is running, the same program cannot be
> evoked again.  But no die messages are shown because perl is unable
> to open the script at all.

The problem is again that some systems don't give you an exclusive lock
for a file that is only open for reading.

Anno


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

Date: 01 Aug 2001 04:55:11 GMT
From: trammell@bayazid.hypersloth.invalid (John Joseph Trammell)
Subject: Re: Having some trouble with map
Message-Id: <slrn9mf0kr.3h1.trammell@bayazid.hypersloth.net>

On 1 Aug 2001 00:58:52 GMT, Abigail <abigail@foad.org> wrote:
> Uri Guttman wrote on MMDCCCXCI September MCMXCIII in
> <URL:news:x71ymw266i.fsf@home.sysarch.com>:
[trimmed]
> .. secondly, i (and many others) think it is semantically msidirecting the
> .. reader of this code. map's (primary) purpose was to generate a new list
> .. from the incoming list. the fact that it can also do side effects is
> .. nice but not critical as you can do that with for loops or for
> .. modifiers.
[snip]
> I'm sorry, but the reasoning that "side effects are ok, but only if
> the keyword is between the expression and the list - it's evil when
> the keyword preceeds the expression" sound like a pile of utter crap.
[snip]

What side effects are these?  I've re-read 'perldoc -f map'; no
clue was imparted.

-- 
If you don't look at the fnord, it can't get you.


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

Date: Wed, 01 Aug 2001 09:40:10 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Having some trouble with map
Message-Id: <6djfmto237acp2ofnuim46oshgsjp47p0q@4ax.com>

John Joseph Trammell wrote:

>What side effects are these?  I've re-read 'perldoc -f map'; no
>clue was imparted.

LOL! There are none. map() doesn't have side effects by itself.

It's just that the pure school of functional programming prefers not to
allow *your* code to have any side effects in the map code block. These
can be (likely incomplete list):

 * changing a "global" variable, e.g. a counter
 * changing a data structure (array, hash)
 * modifying the original data
 * I/O (e.g. printing a line per item)
 * generally: depending on the execution order of the code block for
different items

Abigail is known for being in favor of allowing, even promoting all of
the above.

-- 
	Bart.


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

Date: 01 Aug 2001 07:33:38 +0100
From: nobull@mail.com
Subject: Re: Help with an array and foreach
Message-Id: <u9wv4o8ds5.fsf@wcl-l.bham.ac.uk>

Philip Newton <pne-news-20010731@newton.digitalspace.net> writes:

> Or use for(;;), which is probably more appropriate here...

>     for(my $i = 3; $i <= $#x; $i++) {

On recent versions of Perl there is no longer a significant penalty
for using the more readable alternative:

   for my $i ( 3 .. $#x ) {

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 1 Aug 2001 00:27:23 -0700
From: tvn007@hotmail.com (Tim)
Subject: Re: join lines ?
Message-Id: <21724be2.0107312327.21fcf6fa@posting.google.com>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message news:<3B676446.4AA26BD6@stomp.stomp.tokyo>...
> Tim wrote:
> 
> (snipped)
> 
> > Could someone help me on this ?
>  
> > I am reading lines from input file.
>  
> > I would like to have the output as follow:
>  
> > I did try join and $/= ""\;" and it did not work out for me.
> 
> 
> Post your code you have developed so far,
> working or not, to show sincere effort on
> your part. My preference is to help those
> who help themselves.
> 
> 
> Godzilla!

Below is my code, Could you please give me some suggestions to make it "better" ?

$input1 = 'chain2';
open (INFILE,"$input1");

$/=";";



$array=0;
	while (<INFILE>){
$array=$array+1;
	chomp;

if ($_ =~ /chain\s+\"chain([0-9])\"/){

		print "$1\n"; #chain number

		$chain_number = $1;
			$_ =~ s/^\s+|\s*\n+$//g;
			$_ =~ tr/\t  //d; 		#delete all the tabls and spaces from string
			$_ =~ s/\n//g; 			#delete \n somewhere in the line
			$_ =~ s/\\//g;

   			$chain_input = (split /=/,$_)[1];
			$chain_input =~ tr/\"//d; 
			$chain_input =~ tr/X//d; 

		SWITCH: {
				$chain_number==1 && do {
					@chain1 = split (//,$chain_input); 	#put the data in array
					$scan_chain_length1 = @chain1;
				};
				$chain_number==2 && do {
					@chain2 = split (//,$chain_input); 	#put the data in array
					$scan_chain_length2 = @chain2;
				};
				$chain_number==3 && do {
					@chain3 = split (//,$chain_input); 	#put the data in array
					$scan_chain_length3 = @chain3;
				};
		}#END SWITCH


	}
}
print "scan length is $scan_chain_length3\n";

for ($i=0;$i<=$scan_chain_length3;$i++){
	print "@chain1[$i]\t @chain2[$i]\t@chain3[$i]\n";
}

Below is the input file:"chain2"

        chain "chain1" = "00110011001100110011001100110011001100110011001100\
                      11001100110011001100110011001100110011001100110011\
                      00110011001100110011001100110011001100110011001100\
                      11001100110011001100110011001100110011001100110011\
                      00110011001100110011001100110011001100110011001100\
                      11001100110011001100110011001100110011001100110011\
                      00110011001100110011001100110011001100110011001100\
                      11001100110011001100110011001100110011001100110011\
                      00110011001100110011001100110011001100110011001100\
                      1100110011001100110011001100110011001100110";
        chain "chain2" = "X0011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100110011001\
                      10011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100110011001\
                      10011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100110011001\
                      10011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100110011001\
                      10011001100110011001100110011001100110011001100110\
                      0110011001100110011001100110011001100110011";
        chain "chain3" = "X0011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100110011001\
                      10011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100110011001\
                      10011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100110011001\
                      10011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100110011001\
                      10011001100110011001100110011001100110011001100110\
                      01100110011001100110011001100110011001100AH";


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

Date: 01 Aug 2001 16:35:03 +1200
From: ard@waikato.ac.nz
Subject: mod_perl php4 DBI->connect MySQL bomb segfault solved.
Message-Id: <udvitg8xurs.fsf@area.cc.waikato.ac.nz>


Apache mod_perl children were segfaulting on this:

     DBI->connect('DBI:mysql:irrelevant:irrelevant',
                  'irrelevant',
                  'irrelevant');

(Literally)

I fixed it by recompiling Msql-Mysql-modules against a newer version of
the MySQL client library.  If you are suffering from this problem, make
sure you don't have libmysqlclient.so.9 lying about.

Easily diagnosed with "strace httpd -X"

I guess the moral of the story is to delete all your old libraries when
you upgrade your DB, and whip around recompiling everything that breaks
(sometimes a brave move).


This is fodder for the search engines, in case you couldn't tell.  I'm
crossing it to the PHP group because this problem has been mentioned
there before, because it only crops up when PHP is compiled into Apache.

-- 
_________________________________________________________________________
Andrew Donkin                  Waikato University, Hamilton,  New Zealand


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

Date: 01 Aug 2001 07:48:31 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: perlbug: blacklisted as a spam haven
Message-Id: <slrn9mfd2f.9em.vek@pharmnl.ohout.pharmapartners.nl>

On 31 Jul 2001 09:27:31 -0700,
    John Kristian <jmk2001@engineer.com> wrote:


>I can't contribute a bugfix via perlbug.  My email bounces thus:
>
>Your message cannot be delivered to the following recipients:
>
>  Recipient address: perlbug@perl.com
>  Reason: Server rejected MAIL FROM address.
>  Diagnostic code: smtp;553 5.3.0 Your site is blacklisted as a spam
>haven.
>  Remote system: dns;mail.perl.com
>(TCP|64.164.98.8|41249|199.45.135.9|25) (chthon.perl.com ESMTP
>Sendmail 8.11.4/8.10.0; Tue, 31 Jul 2001 10:09:34 -0600 [MDT])
>
>I tried last night and this morning, with several 'From' email
>addresses, including one address @my former employer (which shouldn't
>appear in any sensible list of spam havens).
>


This is usualy blocked based on the IP number 
64.164.98.8 mta7.pltn13.pbi.net.

It could either be that that IP number or range of numbers has been
known to be used to send spam, and then everyone using that ISP will be
blocked whether innocent or not.  It is also common to block anything
originating from a dialup IP number in which case you need to relay
through your ISP assigned SMTP server.


Villy

 


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

Date: 31 Jul 2001 22:53:20 -0700
From: ranner@gmx.net (Gerfried Ranner)
Subject: RegExp
Message-Id: <a6150edd.0107312153.73e61abb@posting.google.com>

Dear NG!

I am a VB programmer using some RegExp's.
As you are familiar with RE, I am posting here ;o)

I try to get the source-page of a frame definition 
in a html file.

Such a definition can look like this:
<FRAME name="test1" src="http://www.altavista.com">
My RegExp pattern is:
strPattern = "(\<FRAME\s+.*src\s*\=\s*[\""|\']?)(.*)([\""|\']?.*\>)"

THIS WORKS! 
But it returns the whole string, and I would like
to have http://www.altavista.com to be returned, only.

Do you know how to extract this information by using RE?
I think it has something to do with "back references"!?

Thank you very much,
Gerfried Ranner


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

Date: Tue, 31 Jul 2001 23:51:55 -0500
From: "Sped Erstad" <sped@mailandnews.com>
Subject: Regular Expression:  Remove Double Letters from a String?
Message-Id: <3b676f1c$1_1@binarykiller.newsgroups.com>

Hi,

I'm working on "crunching" some strings (think Orwell's 1984!) to remove as
much as I can and create a very very small string.  A couple of ideas are to
remove the "a, an, the" from a string, change "you" to "U", etc. etc.

One other thing I want to do is to crunch two or more letters in a row just
down to one letter:

Letter --> Leter
Mississippi --> Misisipi

I had a couple of ideas that I was going down:

$word =~ s/^(\D)$1{1,}/$1/gi;

(obviously doesn't work since the $1 reference isn't available yet)

$word =~ s/^(\D){2,}/$1/gi;

(this doesn't work since two or more of any character is removed)

Is there a way to do this with a regular expression?

Thanks a lot.....
Sped
sped@mailandnews.com

(In case anyone is curious I'm doing this to make the filenames as small as
possible for a portable mp3 player....)




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: Wed, 01 Aug 2001 05:06:32 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regular Expression:  Remove Double Letters from a String?
Message-Id: <x7y9p4z7vr.fsf@home.sysarch.com>

>>>>> "SE" == Sped Erstad <sped@mailandnews.com> writes:

  SE> One other thing I want to do is to crunch two or more letters in a
  SE> row just down to one letter:

  SE> Letter --> Leter
  SE> Mississippi --> Misisipi

  SE> $word =~ s/^(\D)$1{1,}/$1/gi;

  SE> (obviously doesn't work since the $1 reference isn't available yet)

actually $1 interpolates the value it had before the regex is compiled.

  SE> $word =~ s/^(\D){2,}/$1/gi;

  SE> Is there a way to do this with a regular expression?

backreferences are your friend. read about them in perlre.

	$word =~ s/^(\D)\1/$1/gi;

the /i is not needed since you don't mention any literal alpha chars.

also that is anchored at the beginning of the string which won't remove
doubled chars inside the string.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: 1 Aug 2001 05:33:50 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Regular Expression:  Remove Double Letters from a String?
Message-Id: <9k84bu$417$1@nnrp1.phx.gblx.net>

Sped Erstad <sped@mailandnews.com> wrote:
> I'm working on "crunching" some strings (think Orwell's 1984!) to remove as
> much as I can and create a very very small string. A couple of ideas are to
> remove the "a, an, the" from a string, change "you" to "U", etc. etc.
>
> [...]
>
> (In case anyone is curious I'm doing this to make the filenames as small as
> possible for a portable mp3 player....)

Take a look at Lingua::EN::Squeeze:

  <URL:http://search.cpan.org/search?module=Lingua::EN::Squeeze>

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Wed, 01 Aug 2001 05:54:09 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Regular Expression:  Remove Double Letters from a String?
Message-Id: <3b679956.18b6$21c@news.op.net>

In article <3b676f1c$1_1@binarykiller.newsgroups.com>,
Sped Erstad <sped@mailandnews.com> wrote:
>Letter --> Leter
>Mississippi --> Misisipi
>
>I had a couple of ideas that I was going down:
>
>$word =~ s/^(\D)$1{1,}/$1/gi;

Try

        $word =~ tr/A-Za-z//s;

The 's' is for 'squeeze'.
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Wed, 1 Aug 2001 08:53:30 +0300
From: Roope Havu <rhavu@csc.fi>
Subject: Re: Regular Expression:  Remove Double Letters from a String?
Message-Id: <Pine.LNX.4.33.0108010849240.26721-100000@sampo.csc.fi>

On Tue, 31 Jul 2001, Sped Erstad wrote:

> One other thing I want to do is to crunch two or more letters in a row just
> down to one letter:
>
> Letter --> Leter
> Mississippi --> Misisipi

[cut snip cut]

> Is there a way to do this with a regular expression?
>

in perldoc perlop ( also in The Camel):

  tr/a-zA-Z//s;       # bookkeeper -> bokeper

  If the `/s' modifier is specified,
  sequences of characters that were transliterated
  to the same character are squashed down to a
  single instance of the character.

Translates all a-zA-Z that way. Also in perlfaq4 there's something about
this subject.

Hope this helps,

- Roope



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

Date: Wed, 1 Aug 2001 18:25:49 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Reporting Questionable Programming Activity 
Message-Id: <CnP97.1$ps.370@vic.nntp.telstra.net>

"Smiley" <gurm@intrasof.com> wrote in message
news:3b672381.218715906@news1.on.sympatico.ca...
> The company I'm working for purchased a Perl CGI Script that turns out
> to be seriously faulty - so much so that my boss asked me to
> investigate whether there's any international agency or organization
> set up that we can report this kind of thing to.
>
> Does anybody know?  Thanks :)

Have you reported it to the developer?

Or the Company/Individual you purchased it from?

Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;




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

Date: Wed, 01 Aug 2001 06:58:50 GMT
From: "Txarli" <txarli@txarli.com>
Subject: sending email problems in CGI
Message-Id: <KMN97.146521$vV5.5080094@telenews.teleline.es>

Hi,

I'm using this little script to send email but it does'nt work. Subject, and
From headers doesn't appear when it's delivered at destination, and subject
is allocated at body part with leading ~ character.

Some help will be apreciated,

Thank's

Txarli

Here is the code I use:

#!/usr/bin/perl
require Mail::Mailer;
print "Content-type: text/html\r\n\r\n";

print "<html><body>";

$from_address = 'my@address.com';
$to_address = 'destination@address.com';
$subject = 'Testing mail';
$body = "The Body";


$mailer = Mail::Mailer->new();
$mailer->open({ From    => $from_address,
                To      => $to_address,
                Subject => $subject,
              })
    or die "Can't open: $!\n";

print $mailer $body;
$mailer->close();

print "Sended!";
print "</body></html>";






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

Date: 01 Aug 2001 07:43:38 +0100
From: nobull@mail.com
Subject: Re: simple IO::Select problem on Win32
Message-Id: <u9zo9k8dsy.fsf@wcl-l.bham.ac.uk>

"Allan" <clarke_nospam@hyperformix.com> writes:

> I am looking for a way around the fileevent problem on Win32, by using
> IO::Select to poll for data.

I think you are out of luck, the underlying select() system call on
Win32 is only implemented for sockets.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 01 Aug 2001 07:58:38 +0100
From: nobull@mail.com
Subject: Re: Strange problem...
Message-Id: <u93d7c9sgx.fsf@wcl-l.bham.ac.uk>

"Nathan Randle" <nathan.randle@ntlworld.com> writes:

> Subject: Strange problem...

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> Sorry about writing two questions in quick succesion but this one is
> baffling me.
> 
> I have set a perl script to write the values of check boxes into a file
> seperated by | but when i test the script and look at the file all that's
> included is the | seperators

> So anybody know what I'vedone wrong here?

Obvious question: were the checkboxes checked?  If not then you will
never discover why your program is failing because it isn't.

I'd guess most lurkers in this group would also be able to find
several classic newbie-isms (or realy a learning-from-a-bad-book-ism)
in your code right off.

> I have posted the script and the HTML page I used below:
> 
> Perl Script:
> #!/usr/bin/perl 

Not enabled warning and strictures.

> print "Content-type:text/html\n\n";
> 
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @checks = split(/&/, $buffer);
> foreach $check (@checks) {
>  ($name, $value) = split(/=/, $pair);
>  $value =~ tr/+/ /;
>  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>  $FORM{$name} = $value;
> }

Rolling your own CGI implementation.

> 
> open(MAP,">output.dat");

Forgot to check open succeded.

Made assumptions about PWD under CGI (I do this one too!).

> flock(MAP,2);

Used literal number for flock() constant.

> print MAP "$FORM{'north'}|$FORM{'east'}|";
> print MAP "$FORM{'south'}|$FORM{'west'}|";
> close(MAP);

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

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.  

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 V10 Issue 1420
***************************************


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