[29817] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1060 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 24 16:09:40 2007

Date: Sat, 24 Nov 2007 13:09:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 24 Nov 2007     Volume: 11 Number: 1060

Today's topics:
    Re: Can you detect that a process is waiting on stdin? <ced@blv-sam-01.ca.boeing.com>
    Re: How to get the string Cartesian Products of 2 list <rvtol+news@isolution.nl>
    Re: How to get the string Cartesian Products of 2 list <bik.mido@tiscalinet.it>
    Re: Script to disconnect Linksys WRT54G wireless router <rvtol+news@isolution.nl>
    Re: Script to disconnect Linksys WRT54G wireless router <me@nothingtoseehere.zzx>
    Re: Script to disconnect Linksys WRT54G wireless router <davewilson69@sbcglobal.net>
    Re: Script to disconnect Linksys WRT54G wireless router <davewilson69@sbcglobal.net>
    Re: Script to disconnect Linksys WRT54G wireless router <davewilson69@sbcglobal.net>
    Re: Script to disconnect Linksys WRT54G wireless router <davewilson69@sbcglobal.net>
    Re: Script to disconnect Linksys WRT54G wireless router <spamtrap@dot-app.org>
    Re: Script to disconnect Linksys WRT54G wireless router <BitTwister@mouse-potato.com>
    Re: Script to disconnect Linksys WRT54G wireless router <veatchla@yahoo.com>
    Re: Script to disconnect Linksys WRT54G wireless router <veatchla@yahoo.com>
    Re: Script to disconnect Linksys WRT54G wireless router <ben@morrow.me.uk>
    Re: searching for a pattern for multiple matches <jhu4399@yahoo.com>
    Re: SvUOK always fails on 64bit platform <nospam-abuse@ilyaz.org>
    Re: union of 1 and 0 strings <bik.mido@tiscalinet.it>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 24 Nov 2007 11:31:38 -0800 (PST)
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Can you detect that a process is waiting on stdin?
Message-Id: <5b2060f2-6180-4b47-9d60-581753fff621@s19g2000prg.googlegroups.com>

On Nov 23, 8:10 pm, "Thrill5" <nos...@somewhere.com> wrote:
> I have a Perl library that I wrote that I use to manage an application that
> we have.  The app has about 100 or so CLI's that you can use to get data
> into the app, get data out, produce reports etc.  Anyway, when the CLI's are
> run, stdout and stderr are redirected to a file which I then parse for
> informational and error messages after the CLI completes.  Today I ran into
> a situation where I did not pass all of the correct parameters and the CLI
> then prompted for the required parameter.  My Perl program then just waited
> forever since it was waiting for the output that never came.  Yes this was a
> logic problem in my Perl program, but I would a way to detect this and end
> the Perl program and report the error  (this has happened before.)  I can't
> set an alarm and catch a signal for several reasons; the first is that the
> module needs to be able to run on Win32 systems running Perl 5.6 which does
> not support SIGALRM, and second, some of the CLI's can run for extremely
> long periods of time (hours) while the CLI processes the data.  The CLI's
> are run from Perl using the "system" function.
>
> Is there some way that I can hook into STDIN and then detect when the CLI is
> waiting for input?  If this is possible, then all I need to do is send it a
> carriage return and it will then exit because not all the correct parameters
> were passed.  I will be able to then parse the error message and exit the
> program.  I don't think there is, but I figured I would ask the question
> anyway.  My other alternative is to add some more logic to ensure that all
> the required parameters are there before invoking  the CLI's.  I don't want
> to go down this path if at all possible because each CLI has different
> required parameters, and some have situations where specifying certain
> switches and parameters then require other switches and parameters and it
> would get pretty ugly.  I guess I could also redirect STDIN from a file that
> has a bunch of CR's in it as well, but then I would need to create the file
> (to ensure that it exists) and delete it when I'm done. Please keep in mind
> that a solution must be able to run on Win32 systems.
>

You didn't mention if the CLI's themselves could be tweaked... If so,
perhaps you could pass an argument (eg, 'perl') to them from the
system call. The CLI's, detecting a perl invoker, could error out and
exit rather than prompting.

--
Charles DeRykus


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

Date: Sat, 24 Nov 2007 15:09:23 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: How to get the string Cartesian Products of 2 list
Message-Id: <fi9f0f.1io.1@news.isolution.nl>

xueweizhong@gmail.com schreef:
> Ruud:

>> glob "{@{[ q{a}..q{c} ]}}{@{[ 1..3 ]}}"
>
> Really nice, a pure perl way now rather than dependant on my bash one.
>
> After your inspiration, i get another solution using map:
>
> perl -e 'print join ",", map { my $g=$_; map $g.$_,1..3 } "a".."c"'
> a1,a2,a3,b1,b2,b3,c1,c2,c3

$ perl -wle'
sub mm{my $_0=shift; map {my $g=$_; map $g.$_, @_>1?mm(@_):@{$_[0]}}
@$_0}
print for mm ["a".."c"], [1..3], ["x".."z"], [7..9];
'
a1x7
a1x8
 ...
c3z8
c3z9

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: Sat, 24 Nov 2007 18:54:10 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to get the string Cartesian Products of 2 list
Message-Id: <t6pgk31pli0dl6dundu3965pa1h90odr5j@4ax.com>

On Sat, 24 Nov 2007 06:08:41 -0800 (PST), xueweizhong@gmail.com wrote:

>You misunderstood me. What i want to understand is the difference
>between the output of 2 commands below:
>1. perl -e 'local $" = ","; print join ",", <a{@{[q{001}..q{064}]}}>'
>2. perl -e 'local $" = ","; print join ",", <a{@{[q{001}..q{065}]}}>'

I'm astonished: unless I'm missing something *very* obvious, the only
difference is that the former prints up to the 064 and the second to
065.

>The 2nd one doesn't out of our expection, can you try this to see
>what's going on?:
>$perl -e 'local $" = ","; print join ",", <a{@{[q{001}..q{065}]}}>'
>a

Aren't you by any chance just experiencing some problem with the
prompt and not printing a newline?


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: Sat, 24 Nov 2007 15:13:48 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <fi9faf.1q8.1@news.isolution.nl>

Wilson schreef:

> If you navigate to the Linksys WRT54G "Status -> Router" page, do you
> see the "Disconnect" or "Connect" button?
>
> This connects or disconnects from the DSL modem (depending on whether
> you are already connected or disconnected).

Most WAN-routers also have a textual interface (like telnet) that is
much easier to handle programmatically, so why go the non-easy way?

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: Sat, 24 Nov 2007 11:14:22 -0600
From: DTC <me@nothingtoseehere.zzx>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <r_Y1j.1167$4q5.207@nlpi069.nbdc.sbc.com>

Wilson wrote:
> On Fri, 23 Nov 2007 17:29:57 -0600, DTC wrote: 
>> I was just reminded by my partner we used it on the Linksys WRT54G four 
>> years ago.
> 
> Can you post that Perl script? I'd love to try it out on my Linksys WRT54G
> wireless router!

I'll see if we have it saved somewhere. We haven't worked with Linksys 
units for some time.


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

Date: Sat, 24 Nov 2007 09:58:47 -0800
From: Wilson <davewilson69@sbcglobal.net>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <CEZ1j.1172$4q5.564@nlpi069.nbdc.sbc.com>

On Sat, 24 Nov 2007 11:14:22 -0600, DTC wrote:

>> Can you post that Perl script? 
> 
> I'll see if we have it saved somewhere. 

Thanks.


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

Date: Sat, 24 Nov 2007 10:01:40 -0800
From: Wilson <davewilson69@sbcglobal.net>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <iHZ1j.1173$4q5.1009@nlpi069.nbdc.sbc.com>

On Sat, 24 Nov 2007 15:13:48 +0100, Dr.Ruud wrote:

> Most WAN-routers also have a textual interface (like telnet) that is
> much easier to handle programmatically, so why go the non-easy way?

I am almost to the point of giving up on Perl so I think I'll follow Ben's
prior suggestions which seem to be more powerful than Perl.

I think, based on my experience only, that for Perl to interpret Javascript
is something nobody has ever posted, so, who am I, an avowed beginner and
non programmer, to get it working first.

I have just one or two more experiments to try. I don't have a programmers'
mind, but I do see a few more things I can tweak and try as every time I
try something, I see something else that "might" be the culprit or the
solution. 

I find that part fun even though I don't know how to program. I sure hope
to post a solution for the world to benefit - but first I have to get it
working.

Thanks for the advice.


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

Date: Sat, 24 Nov 2007 18:06:40 GMT
From: Wilson <davewilson69@sbcglobal.net>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <QKZ1j.77371$Um6.73330@newssvr12.news.prodigy.net>

On Fri, 23 Nov 2007 02:40:00 +0000, Ben Morrow wrote:

> Have you tried using http://www.research.att.com/sw/tools/wsp/? If the
> web page served by the router is being too clever (and they *always*
> seem to be) then this may help.

Hi Ben,
You have always been the one useful voice of reason. The rest were voices
of reason, but not useful (like the ones who lambasted my lack of
programming experience or those who claimed it could be done w/o any
evidence). They were right, of course, but they weren't helpful to getting
the task accomplished.

For your insight, I appreciate. I will try just a couple more experiments
with the Perl approach as I hate to lose. I'm not a programmer, nor do I
have a programmer's mentality, but, I just hate it when something should
work but it doesn't for some unknown reason. That irks me and irked me in
my dreams all night, sadly to say.

Anyway, I'll be re-reading your posts and attempting the closest thing to
what looks like it will work to perform the following:

a) Open an https web page on the Linksys WRT54G router
b) Log in with a username of null and a password of "letmein"
c) Press a javascripted button on that web page called "Disconnect"

Thanks!


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

Date: Sat, 24 Nov 2007 18:13:08 GMT
From: Wilson <davewilson69@sbcglobal.net>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <UQZ1j.70877$YL5.36946@newssvr29.news.prodigy.net>

On Thu, 22 Nov 2007 08:27:27 -0500, Sherman Pendley wrote:
> What nonsense. You said yourself that you're not a programmer and don't know
> Perl - what makes you think that something is impossible simply because *you*
> can't figure it out?

Hi Sherman,
After calming down, I must apologize for saying "Perl can't do it", as, as
you noted, I am not a programmer, nor do I have a programmer's mentality
 ... so who am I to say whether it can be done or not. In my frustration, I
guess I was "blaming" perl but I did not mean to malign that language.

It's just that I really hate it when I have to do anything manual and,
despite the fact I'm not a programmer-type person, I always try to cut down
on the number of button clicks I do, even if it's only three or five clicks
when I do it a lot. I find that makes me much more efficient even if there
is a lot of up-front work to get the job done.

So, I _will_ automate the task of disconnecting and reconnecting from the
ISP - I just don't know how yet. I have just a few more things to try
(although I said that days ago) and I'll get the damn thing working.

Thanks and sorry for not being of the mind and body like you guys are!
I admire you and what you can do with code!
Wilson


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

Date: Sat, 24 Nov 2007 13:55:11 -0500
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <m1d4tzmq28.fsf@dot-app.org>

Wilson <davewilson69@sbcglobal.net> writes:

> On Fri, 23 Nov 2007 16:54:36 -0500, Sherman Pendley wrote:
>> In a generic sense, there are literally hundreds of examples of Perl doing what
>> you claim it can't do - just google for "WWW::Mechanize" or "perl web scraping"
>> to see them. There is absolutely no question that Perl is capable of logging
>> into an https web server and performing the moral equivalent of a button click.
>
> Even web pages which seem to require "javascript" in order to view the
> buttons?

No, WWW::Mechanize doesn't run the JavaScript. But to be fair, you didn't mention
the JavaScript requirement - all you said was that Perl couldn't fetch an https
page and click a button. :-)

One approach you might try is viewing the source of the HTML page in your browser,
figuring out what the JS does in a browser, and then writing the same behavior into
your Perl script.

> BTW, I tested the router - it does not need java; just javascript.

JS is annoying enough. Makes me happy I haven't upgraded my ancient BEFSR41. :-)

sherm--

-- 
WV News, Blogging, and Discussion: http://wv-www.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Sat, 24 Nov 2007 18:56:46 GMT
From: Bit Twister <BitTwister@mouse-potato.com>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <slrnfkgsvf.dgb.BitTwister@wb.home.invalid>

On Sat, 24 Nov 2007 18:13:08 GMT, Wilson wrote:

> After calming down, I must apologize for saying "Perl can't do it", as, as
> you noted, I am not a programmer, nor do I have a programmer's mentality
> ... so who am I to say whether it can be done or not. In my frustration, I
> guess I was "blaming" perl but I did not mean to malign that language.

Hey, you can learn to work the computer, or let the computer work you.


> It's just that I really hate it when I have to do anything manual and,
> despite the fact I'm not a programmer-type person, I always try to cut down
> on the number of button clicks I do, even if it's only three or five clicks
> when I do it a lot. I find that makes me much more efficient even if there
> is a lot of up-front work to get the job done.

Yep, computer is nice for automation and repetitive tasks.

> So, I _will_ automate the task of disconnecting and reconnecting from the
> ISP - I just don't know how yet. I have just a few more things to try
> (although I said that days ago) and I'll get the damn thing working.

I do not do windows, I run Mandriva Linux.
I plugged Mechanize into my Software Management application search
box, and 7t'h selection click gave me

perl-WWW-Mechanize-Shell - WWW::Mechanize::Shell - An interactive
shell for WWW::Mechanize

This module implements a www-like shell above WWW::Mechanize and also
has the capability to output crude Perl code that recreates the
recorded session. Its main use is as an interactive starting point for
automating a session through WWW::Mechanize.



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

Date: Sat, 24 Nov 2007 13:04:42 -0600
From: l v <veatchla@yahoo.com>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <13kgteci9g5g360@news.supernews.com>

Wilson wrote:
> On Fri, 23 Nov 2007 23:25:23 -0600, l v wrote:
>> My WRT54G (v8.00.2) is not configured the same as yours so I can not 
>> test the script for you.  Nor does my device connect directly to the 
>> internet, rather it sits behind my DSL modem.  No connect/disconnect 
>> buttons.
> 
> Hi lv,
> My WRT54G also sits "behind" a DSL modem.
> 
> If you navigate to the Linksys WRT54G "Status -> Router" page, do you see
> the "Disconnect" or "Connect" button?
> 
> This connects or disconnects from the DSL modem (depending on whether you
> are already connected or disconnected).

Wilson

As I stated, my WRT54G is configured differently than yours -- no 
"disconnect" or "connect" button under "Status -> Router".

While c.l.p.m is not the proper newsgroup for this, I see from your HTML 
posting, that you have your WRT54G set to use PPPoE.  Mine is not.

Let me guess at your problem.  Your DSL modem changes public IP address 
on occasion.  When it does you need to re-connect your WRT54G to get the 
new pubic IP address as well.  Am I correct?

I set my WRT54G to use a Static IP (Setup -> Basic Setup).  My DSL 
modem's IP address is 192.168.1.1

I use the following settings for the WRT54G:
Internet IP Address:    . . .  192.168.1.10
          Subnet Mask:   . . .  255.255.255.0
          Gateway: 	. . .  <my DSL ip>
          Static DNS 1: 	. . .  my ISPs 1st DNS server
          Static DNS 2: 	. . .  my ISPs 2nd DNS server
          Static DNS 3: 	. . .  0.0.0.0

Local IP Address:    . . .  192.168.2.1
          Subnet Mask:   . . .  255.255.255.0

I then have no need to disconnect and re-connect the WRT54G when my 
DSL's pubic ip address changes.

-- 

Len


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

Date: Sat, 24 Nov 2007 13:06:56 -0600
From: l v <veatchla@yahoo.com>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <13kgtihaok3nhb0@news.supernews.com>

Dr.Ruud wrote:
> Wilson schreef:
> 
>> If you navigate to the Linksys WRT54G "Status -> Router" page, do you
>> see the "Disconnect" or "Connect" button?
>>
>> This connects or disconnects from the DSL modem (depending on whether
>> you are already connected or disconnected).
> 
> Most WAN-routers also have a textual interface (like telnet) that is
> much easier to handle programmatically, so why go the non-easy way?
> 

I port scanned my WRT54G when I first got it.  Unlike my DSL modem, it 
does not respond to telnet nor ssh.  I am guessing the OP's wireless 
device is the same.

-- 

Len


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

Date: Sat, 24 Nov 2007 20:36:58 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <akem15-o2c.ln1@osiris.mauzo.dyndns.org>


Quoth Wilson <davewilson69@sbcglobal.net>:
> On Sat, 24 Nov 2007 15:13:48 +0100, Dr.Ruud wrote:
> 
> > Most WAN-routers also have a textual interface (like telnet) that is
> > much easier to handle programmatically, so why go the non-easy way?
> 
> I am almost to the point of giving up on Perl so I think I'll follow Ben's
> prior suggestions which seem to be more powerful than Perl.

Err, no; you misunderstood me. The tool I pointed you at (WSP) helps
find out what's actually going on between the browser and the router, so
you can then emulate that in Perl (or anything else, for that matter).
If you were feeling macho you could just run tcpdump and work from
there... :)

Ben



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

Date: Sat, 24 Nov 2007 11:12:54 -0800 (PST)
From: jhu <jhu4399@yahoo.com>
Subject: Re: searching for a pattern for multiple matches
Message-Id: <28b07c5d-e679-4e53-935f-cea23000b7fb@d21g2000prf.googlegroups.com>

On Nov 23, 8:11 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth jhu <jhu4...@yahoo.com>:
>
>
>
>
>
> > On Nov 23, 6:35 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> > > Quoth jhu <jhu4...@yahoo.com>:
>
> > > > Can anyone tell me using Perl how to find all matching patterns. So if
> > > > I have this one big string of say a html web page which contains
> > > > multiple IP's and my pattern which is \d{1,3}\.\d{1,3}\.\d{1,3}\.
> > > > \d{1,3} then how do I go about setting up my code in some sort of
> > > > while loop to find all instances of matches ?
>
> > > Use the /g modifier. See 'Regexp Quote-Like Operators' in perldoc
> > > perlop, particularly the section starting "In scalar context, each
> > > execution of "m//g...".
>
> > > > Also can someone in
> > > > simple terms explain what a back reference is ? Is it simply the
> > > > pattern found ?
>
> > > perldoc perlretut
>
> > Ben thanks but I'm not on Unix or Linux but rather on Windows and
> > MV6.0.
>
> Huh? What difference does that make? Do you mean you can't find the
> perldocs? perldoc works perfectly well on Win32, or ActivePerl installs
> a nice HTMLified version in c:\perl\html.
>
> If you mean 'I'm not actually using Perl, but some other system that
> provides Perlish regexen' then: sorry, go ask somewhere else. This
> newsgroup is for discussing Perl.
>
> Ben- Hide quoted text -
>
> - Show quoted text -

Ok I did not understand that I can still view Perl docs online.


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

Date: Sat, 24 Nov 2007 20:02:50 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: SvUOK always fails on 64bit platform
Message-Id: <fia01a$596$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
cyl 
<u8526505@gmail.com>], who wrote in article <6194303c-a628-48fa-9c95-39d4c1b58d98@p69g2000hsa.googlegroups.com>:
> I have a dll exporting a function for perl which accepts an unsigned
> interger parameter. In the exported function I use SvUOK to check what
> the returned values will be by supplying different values from perl
> script. Here are what I get
> 
> 32bit
> (in perl)                                (SvUOK return value)
> 0 - 0x7fffffff                            false
> 0x80000000 - 0xffffffff             true
> 
> 64bit
> (in perl)                                (SvUOK return value)
> 0-0xffffffff                               false
> 
> I'm wondering why there's such a difference on 32 and 64 bit platform.
> My thought is if SvUOK returns true then the passed parameter should
> be an unsigned interger but it is true only on 32 bit platform. Do I
> misuse this macro? How should I correct it? Thanks.

One other thing to mention: SvUOK() is not Perl.  You are not supposed
to TOUCH any thing not Perl unless you are capable to understand
YOURSELF what it means...  Kind of self-censoreship: if you have to
ask, you are not ready to USE it for quite some time.

SvUOK() is concerned with the INTERNAL REPRESENATION of a Perl value,
not with the value itself.  This says NOTHING about the value, but
says something about "the history of how it was obtained".  Some
operations will ALWAYS produce SvUV; some will never; some will
differentiate on the range of values (as you observe).

Hope this helps,
Ilya


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

Date: Sat, 24 Nov 2007 15:13:37 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: union of 1 and 0 strings
Message-Id: <hkbgk3tg2na0qf2rdpkgnlherintf2rp83@4ax.com>

On Sat, 24 Nov 2007 03:40:24 -0800 (PST), "avilella@gmail.com"
<avilella@gmail.com> wrote:

>  DB<32> x $seqchoice
>0  '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>1 0 0 '
>  DB<33> x $outgroup
>0  '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>0 1 0 '
>
>and I want to make the "union" of the "ones" in $outgroup to
>$seqchoice, so that I end up with:
>
>  DB<32> x $seqchoice
>0  '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>1 1 0 '
>  DB<33> x $outgroup
>0  '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>0 1 0 '
>
>notice the "1" in the penultimate position in $seqchoice.

Many, many ways to do so. For one thing, spaces are kinda of a PITA.
You may want to get rid of them by splitting into arrays and process
them. Though, I would still go with strings, possibly getting rid of
spaces and using stringwise logical operators and then possibly
massaging back the resulting string:


  #/usr/bin/perl
  
  use strict;
  use warnings;
  
  my $seqchoice = '000000000000000011111111111111111100';
  my $outgroup  = '000000000000000000000000000000000010';
  
  local $\="\n";
  print for $seqchoice, $outgroup => $seqchoice | $outgroup;
  
  __END__

  000000000000000011111111111111111100
  000000000000000000000000000000000010
  000000000000000011111111111111111110


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: 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 1060
***************************************


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