[19906] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2101 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 9 11:05:49 2001

Date: Fri, 9 Nov 2001 08:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005321910-v10-i2101@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 9 Nov 2001     Volume: 10 Number: 2101

Today's topics:
    Re: 600 lines (Mark Jason Dominus)
    Re: 600 lines (Rafael Garcia-Suarez)
    Re: a good perl editor - know one?? (Chris Russell)
    Re: converting ^M characters to \n (Tad McClellan)
    Re: converting ^M characters to \n <flavell@mail.cern.ch>
    Re: file copy problems (maddman)
    Re: Help needed!! news@roaima.freeserve.co.uk
    Re: How to use PIPE in CGI? (Tad McClellan)
    Re: How to use PIPE in CGI? news@roaima.freeserve.co.uk
        I am having a problem with my perl script.  <daffyduk@prodigy.net>
    Re: i do not understand it(the =~s/.../.../), thanx! (Honza Pazdziora)
        Moving to the start of a file (Will)
    Re: Moving to the start of a file (Anno Siegel)
    Re: Moving to the start of a file <ronh@iainc.com>
    Re: Naive Q: Why Java speed >> Perl speed? <user2048@yahoo.com>
    Re: Need Some Help <mjcarman@home.com>
        Regular Expressions (Anya Miretsky)
    Re: Regular Expressions (Rafael Garcia-Suarez)
    Re: Regular Expressions (John J. Trammell)
    Re: Regular Expressions (Anno Siegel)
    Re: Removing whitespace from list / array (Tad McClellan)
    Re: Removing whitespace from list / array <loophole64@home.com>
    Re: repeated string (Houda Araj)
    Re: repeated string (Mark Jason Dominus)
    Re: repeated string (Tad McClellan)
        Shift Operators - newbie <jessica.bull@broadwing.com>
    Re: Shift Operators - newbie <ronh@iainc.com>
    Re: Using TCP "keep alives" with IO::Socket news@roaima.freeserve.co.uk
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 09 Nov 2001 14:45:45 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: 600 lines
Message-Id: <3bebec16.5a0d$2c1@news.op.net>

In article <slrn9unfbr.idv.rgarciasuarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>> > He has a problem. When his script becomes longer than 600 lines of code, the
>> > perl interpreter tells him, that there's a syntax error. he tried to put
>
>May be related to the limitation on formats.
>
>See perldiag/Runaway format.

It is about as likely to be related to sunspots.

The 'runaway format' error is a run time error, not a compile time
error.  It has nothing to do with the length of the format, the length
of the code, or any other lexical property of the program.

-- 
@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: 9 Nov 2001 15:27:55 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: 600 lines
Message-Id: <slrn9untgr.clh.rgarciasuarez@rafael.kazibao.net>

Mark Jason Dominus wrote in comp.lang.perl.misc:
> Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
> >
> >May be related to the limitation on formats.
> 
> It is about as likely to be related to sunspots.

How can I tell, which such a descriptive problem report ?

> The 'runaway format' error is a run time error, not a compile time
> error.  It has nothing to do with the length of the format, the length
> of the code, or any other lexical property of the program.

OK -- Next time I'll post about something I understand ;-)

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Fri, 09 Nov 2001 15:33:58 GMT
From: C.G.Russell@bradford.ac.uk (Chris Russell)
Subject: Re: a good perl editor - know one??
Message-Id: <3bebf58f.711304872@news.brad.ac.uk>

On Mon, 5 Nov 2001 21:01:17 +0000 (UTC), Louis Erickson
<wwonko@rdwarf.com> wrote:

>Paul Spitalny <pauls@cascadelinear.com> wrote:
>: Hi,
>: Anyone know of a text editor (For a windows platform) specifically
>: targeted to PERL that has features like color coding of key works and
>: other nice development aids?
>
>Once again, I'll reccomend Komodo by ActiveState.  If I recall properly
>there is a "personal use" version which is free, but the others cost

It's a "non-commercial use" license rather than just "personal use".
Working in education it suits my needs just fine but for other kinds
of non-government or non-education projects you might need to check
whether the license covers you or not. 

I downloaded it when I got my copy of ActiveState Perl and whilst I
wouldn't say it's great I have yet to find a big enough reason to
change now that I'm used to it and familar with it. The major
annoyances for me are the Word style highlighting of grammar/synatax
errors that it picks up and these you can turn off if you don't want
them. 

>The only problems
>I'm aware with it are that it's based on Mozilla, and therefore a little
>slow, and a little disc-hungry.

More memory than disc I would have said with it's Mozilla-ness. I have
128Mb here at work and it's a little slow. Back home I have half a gig
with a similar spec processor (Celery 533) and it goes like the
proverbials off a shiny shovel. 



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

Date: Fri, 09 Nov 2001 14:23:12 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: converting ^M characters to \n
Message-Id: <slrn9unmld.mka.tadmc@tadmc26.august.net>

Jan-Willem <j.w.haaring@azu.nl> wrote:

[snip correct stuff]

>Besides that,  $x =~ s/\^M//; will not work either because the ^M you
                ^^
                ^^

I will do my best to not comment on the poor choice of variable name.


>see in your file is 
>actually 0D0A in hex. This should do the trick:


No, what is sometimes displayed as ^M is the ASCII carriage return
character (just 0D in hex. 0A is the ASCII line feed (newline) char).


>$x =~ s/(\x0D\x0A)/\n/g;


To strip carriage return characters:

   $x =~ tr/\r//d;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 9 Nov 2001 15:50:54 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: converting ^M characters to \n
Message-Id: <Pine.LNX.4.30.0111091543140.20291-100000@lxplus023.cern.ch>

On Nov 9, Tad McClellan inscribed on the eternal scroll:

> No, what is sometimes displayed as ^M is the ASCII carriage return
> character

No objection there.

> 0A is the ASCII line feed (newline) char).

Newline (\n) is a logical concept; considering all of the platforms on
which Perl has been implemented, many of them - but not all - use
ASCII line feed to represent the newline.

This might seem like nitpicking, but by approaching things in the
right frame of mind it's possible to write programs so that they are
portable to other platforms without extra work.  perldoc perlport
(as you're well aware) discusses these issues in a helpful way.

cheers



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

Date: 9 Nov 2001 07:37:18 -0800
From: maddman_75@yahoo.com (maddman)
Subject: Re: file copy problems
Message-Id: <bea807ca.0111090737.77b689c7@posting.google.com>

Thanks for all the replies.  Yes, I did read the docs on File::Copy,
and no I didn't understand it completely.  I also didn't know about
setting use warnings and use strict.  These helped me find the minor
bugs in the script.  However, it is still not copying the file!

Here's what I have now

# Copy newsletter to the share
use warnings;
use strict;
use File::Copy;

my $source ="C:\\newsltr\\$name";
my $dest = q(K:\newsltr.pub);
copy($source, $dest) || warn "Can't do copy";
print $source;
print $dest;

Output - 

Can't do copy at C:\newsltr\newsltr.pl line 52
C:\newsltr\newsltr vol4iss39.pub
K:\newsltr.pub

Could it be as issue with the space in the filename?  I'm doing this
on win2k.  As I'm not the one producing the file, I can't remove the
space in the filename.

Any other thoughts would be greatly appreciated.

maddman


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

Date: 9 Nov 2001 14:53:04 GMT
From: news@roaima.freeserve.co.uk
Subject: Re: Help needed!!
Message-Id: <3bebedd0@news.netserv.net>

Jason Kelley <loophole64@home.com> wrote:
> Let's see your code.

Not all 500+ lines of it, though. For now, just the subroutine
encapsulating line 527.

Chris


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

Date: Fri, 09 Nov 2001 14:23:13 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to use PIPE in CGI?
Message-Id: <slrn9unmsn.mka.tadmc@tadmc26.august.net>

Ryan <hkyeung9@ie.cuhk.edu.hk> wrote:

>I have a problem about how to do pipe in CGI. When in command mode, I can do
>the following:
>eg.a.pl:(perl a.pl)
>...
>open(PIPE, "| perl xyz.pl");
>close(PIPE);


You should check the return value from _both_ the open() and the close().

See:

   perldoc -q pipe

      "Why doesn't open() return an error when a pipe open fails?"


>however, when i do as cgi, it can't works(see through browser) What's wrong
>is it?


Use the absolute path to the perl executable, /usr/bin/perl, or whatever.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 9 Nov 2001 15:08:40 GMT
From: news@roaima.freeserve.co.uk
Subject: Re: How to use PIPE in CGI?
Message-Id: <3bebf177@news.netserv.net>

Ryan <hkyeung9@ie.cuhk.edu.hk> wrote:
> however, when i do as cgi, it can't works(see through browser) What's wrong
> is it?

What exactly do you see when you say it doesn't work? Does the error
log from the web server report anything?

Chris








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

Date: Fri, 09 Nov 2001 15:47:56 GMT
From: "The Williamsons" <daffyduk@prodigy.net>
Subject: I am having a problem with my perl script. 
Message-Id: <MUSG7.498$gW3.96316521@newssvr15.news.prodigy.com>

I am having a problem with my perl script.

I am trying to mv info from one location to another and the script says its
done but the info is not there?

This is the part of the script that is messed up:

system("mv" .$file . "/directory/new" .$file);




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

Date: Fri, 9 Nov 2001 15:09:14 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: i do not understand it(the =~s/.../.../), thanx!
Message-Id: <slrn9unscp.8kbf.adelton@nemesis.fi.muni.cz>

On 4 Nov 2001 00:39:48 -0800, hugh1 <weiwe1@yeah.net> wrote:
> i can not know how to understand it:
> 
> $name =~ s /%([\da-f][\d[a-f]/chr(hex($1))/egi
> 
> i do not know what sould first to do!!!!!
> it translate  %[0-9][a-f][a-f] to charects????? but $1 point to what??
> and i can find usage about chr and hex and tr/../../

$ perl 
s /%([\da-f][\d[a-f]/chr(hex($1))/egi
/%([\da-f][\d[a-f]/: unmatched () in regexp at - line 1.
$

You should first get your regexp to at least be correct regexp. Then
start analysing.

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
 .project: Perl, mod_perl, DBI, Oracle, auth. WWW servers, XML/XSL, ...
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: 9 Nov 2001 07:03:00 -0800
From: w_keeling@yahoo.com (Will)
Subject: Moving to the start of a file
Message-Id: <cd46a84c.0111090703.ab3ab58@posting.google.com>

Hi,

I was wondering if anyone could help. I'm writing records to a file
sequentially. After writing X number of records, I need to move back
to the top line of the file to re-write some header information on the
first line.

I have a filehandle open for writing using open(FILE '>output.txt').

If I use seek(FILE, 0, 0) to position back at the top, it doesn't seem
to work and the line is written in the current position.

Does anyone know how to move back to the top of the file on an open
handle and overwrite data that may already be there?

Many thanks,

Will


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

Date: 9 Nov 2001 15:47:09 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Moving to the start of a file
Message-Id: <9sgtpt$gqf$1@mamenchi.zrz.TU-Berlin.DE>

According to Will <w_keeling@yahoo.com>:
> Hi,
> 
> I was wondering if anyone could help. I'm writing records to a file
> sequentially. After writing X number of records, I need to move back
> to the top line of the file to re-write some header information on the
> first line.
> 
> I have a filehandle open for writing using open(FILE '>output.txt').
> 
> If I use seek(FILE, 0, 0) to position back at the top, it doesn't seem
> to work and the line is written in the current position.
> 
> Does anyone know how to move back to the top of the file on an open
> handle and overwrite data that may already be there?

That should work the way you are trying.  Check the return value of
seek, and print $! if it's false.  I suspect it fails.

Anno


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

Date: Fri, 09 Nov 2001 15:49:53 GMT
From: "Ron Hartikka" <ronh@iainc.com>
Subject: Re: Moving to the start of a file
Message-Id: <BWSG7.964$oM5.77497@typhoon.mw.mediaone.net>

You can only do this if you are using fixed length records. Are you?
"Will" <w_keeling@yahoo.com> wrote in message
news:cd46a84c.0111090703.ab3ab58@posting.google.com...
> Hi,
>
> I was wondering if anyone could help. I'm writing records to a file
> sequentially. After writing X number of records, I need to move back
> to the top line of the file to re-write some header information on the
> first line.
>
> I have a filehandle open for writing using open(FILE '>output.txt').
>
> If I use seek(FILE, 0, 0) to position back at the top, it doesn't seem
> to work and the line is written in the current position.
>
> Does anyone know how to move back to the top of the file on an open
> handle and overwrite data that may already be there?
>
> Many thanks,
>
> Will




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

Date: 9 Nov 2001 14:52:10 GMT
From: user2048 <user2048@yahoo.com>
Subject: Re: Naive Q: Why Java speed >> Perl speed?
Message-Id: <Xns915464B68BA1Emytokxyzzy@209.155.56.82>

> (in the Java example)
>           firstname = _firstname.clone();
>           lastname = _lastname.clone();
>           birthdate = _birthdate.clone();

No need to clone() - Java strings are immutable. Just copying the
reference would be sufficient, and faster:
           firstname = _firstname;  // etc.

Interesting thread.


logan@cs.utexas.edu (Logan Shaw) wrote in
news:9s9h0s$62p$1@charity.cs.utexas.edu: 

> ...
> In Java, it'd be more like this:
> 
>      public class MyObject
>      {
>          String firstname;
>          String lastname;
>          String birthdate;
> 
>          MyObject (String _firstname, String _lastname, String
>          _birthdate) {
>           firstname = _firstname.clone();
>           lastname = _lastname.clone();
>           birthdate = _birthdate.clone();
>          }
>      }
>...


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

Date: Fri, 09 Nov 2001 08:14:10 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Need Some Help
Message-Id: <3BEBE4B2.CBE46FA0@home.com>

Sophie Anderson wrote:
> 
> I just started learning Perl a few hours ago at www.perl.com
> 
> I have 3 databases or (files).
> [...]
> I need to read all files so that when I type "Enter the borrower
> number: " all fields from all 3 fields are displayed.
> I could do this pretty easily in C/C++ but my boss want it in Perl
> claiming that Perl can handle files better.

I wonder if he knows that perl is written in C? :)

> At www.perl.com I learned how to open/close files, put each line
> (record) into arrays, split the line into fields, etc. Also Perl uses
> regular expression to match field/record.
> 
> My questions:
> How do read 3 files together? Should I use the sleep function?
> But how?

You use sleep() when you want to insert a delay. What does that have to
do with reading files? I think you would do best to read the files one
at a time and extract the relevant records.

> Are there any Perl built in functions that I should know instead of
> spending limited time figuring out the codes?

I've no idea how to make a general recommendation on functions. I
suggest taking a look at the "Perl Functions by Category" section of the
perlfunc manpage.

In case you don't know already, every installation of Perl includes a
wealth of standard documentation. If you're on a Win* platform, it
should be available as HTML. There's also a tool for reading it, called
perldoc (on most platforms). Just type 'perldoc perl' and 'perldoc
perldoc' at a command line. That should get you started. To read the
perlfunc manpage, type 'perldoc perlfunc'.

> Is/are there any "worth to buy" Perl book(s) out there on files
> handling? (I have spent quite a lot of money buying useless books.)

There are a number of good books on Perl. I'd start with Learning Perl,
3rd Edition. (Randal Schwartz & Tom Phoenix; O'Reilly)

-mjc


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

Date: 9 Nov 2001 07:45:37 -0800
From: anyam_99@yahoo.com (Anya Miretsky)
Subject: Regular Expressions
Message-Id: <1e0c6f7a.0111090745.385e55b@posting.google.com>

I am new to Perl, so therefore the simple question..

How do I use a regular expression to make all uppercase letters in a
string into lowercase?

I've tried $x =~ s/[A-Z]/[a-z]/g; and this doesn't work. I've also
looked at the perlre man page and the Camel book, but can't find what
I need.

Please help.
Thanks.


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

Date: 9 Nov 2001 15:48:38 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Regular Expressions
Message-Id: <slrn9ununl.cof.rgarciasuarez@rafael.kazibao.net>

Anya Miretsky wrote in comp.lang.perl.misc:
> I am new to Perl, so therefore the simple question..
> 
> How do I use a regular expression to make all uppercase letters in a
> string into lowercase?

There's more than one way to do it, but you don't need a regular
expression. The lc() function does what you want (see perlfunc).

> I've tried $x =~ s/[A-Z]/[a-z]/g; and this doesn't work.

That would be tr/// instead of s///g (and without the brackets).
Look up tr/// in perlop.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Fri, 9 Nov 2001 09:54:05 -0600
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: Regular Expressions
Message-Id: <slrn9unv29.jkp.trammell@haqq.el-swifto.com>

On 9 Nov 2001 07:45:37 -0800, Anya Miretsky <anyam_99@yahoo.com> wrote:
> I am new to Perl, so therefore the simple question..
> 
> How do I use a regular expression to make all uppercase letters in a
> string into lowercase?
> 
> I've tried $x =~ s/[A-Z]/[a-z]/g; and this doesn't work. I've also
> looked at the perlre man page and the Camel book, but can't find what
> I need.
> 
You can just use the lc() function.  Must it be a regex?



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

Date: 9 Nov 2001 16:02:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regular Expressions
Message-Id: <9sgulo$gqf$2@mamenchi.zrz.TU-Berlin.DE>

According to Anya Miretsky <anyam_99@yahoo.com>:
> I am new to Perl, so therefore the simple question..
> 
> How do I use a regular expression to make all uppercase letters in a
> string into lowercase?
> 
> I've tried $x =~ s/[A-Z]/[a-z]/g; and this doesn't work. I've also
> looked at the perlre man page and the Camel book, but can't find what
> I need.

That's where the much-neglected chapter "Perl Functions by Category"
comes in.  It's in the camel as well as in the perlfunc man page, and
in the category "Scalar manipulation" you might have found that Perl
has a special function to transform text to lower case, named lc.

A regex replacement is not best suited for this kind of character
manipulation, though it can be done too, in multiple ways.  For an
operator that does character replacement in a superficially regex-like
way, look up tr///.

Anno


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

Date: Fri, 09 Nov 2001 15:07:57 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Removing whitespace from list / array
Message-Id: <slrn9unpkk.mp9.tadmc@tadmc26.august.net>

mark <mark.adaoui@siemens.at> wrote:

>valid Tokens are numbers, (mainly integers) characters, parenthesis &
>curlies, also something we refer to as the colon operator ::=


   push @tokens, m/[0-9]+|[a-zA-Z_]+|[{}()]|::=/g;

or, if you prefer to be able to read what you have just written:

   push @tokens, m/[0-9]+      |
                   [a-zA-Z_]+  |
                   [{}()]      |
                   ::=
                  /gx;

:-)

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 9 Nov 2001 09:37:26 -0600
From: "Jason Kelley" <loophole64@home.com>
Subject: Re: Removing whitespace from list / array
Message-Id: <9sgt4n$5m2$1@news.chorus.net>


"mark" <mark.adaoui@siemens.at> wrote in message
news:487f3b0f.0111090021.23a23741@posting.google.com...
> legal tokens are the elements of the telegram that i wish to make a
> new array from, so basicly i want to know how to scan/filter this txt
> file, for approprite tokens, then create an array of these tokens.
> Without generating the empty strings (thx Tad).

Name's Jason, np.

Take your original statement:

push @Tokens, m/[0-9]*|[a-zA-Z_]*[{}]*[()]*[::=]*/gs;

change to:

push @Tokens, m/[0-9]|[a-zA-Z_]|[{}()]|::=/gs;

* is a postfix operator, which means to match the preceding regular
expression repetitively as many times as possible. Not neccesary here.

[] is used for matching sets, so if you put ::= inside of them, you're
saying to match either : or : or =, which is redundant for one, and not what
you want to do. Leaving it outside of [] makes it match the entire string.

-Jason




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

Date: 9 Nov 2001 06:30:50 -0800
From: houda.araj@cogmedia.com (Houda Araj)
Subject: Re: repeated string
Message-Id: <7d0055df.0111090630.47c9ef78@posting.google.com>

> > I have a file that I want a perl script to (1) read, (2) find all
> > identical repeated strings within that file and (3) mark the repeated
> > strings with <>
> > Any info is appreciated. Thanks!
> 
> How large is the file ?

The file is about 20 pages. 
> 
> The reason is, you need to parse the entire file for sure.
> If the file is fairly small, you can store each line you find as a key in
> the hash and increment that key by 1 every time it's encountered. This is
> (comparatively) fast but will take up a lot of memory.
> 
> The other option is to use a module to calculate the checksum for each line,
> then use that in a logic similar to the above. Calculating the checksum will
> slow down reading the file, but the checksum stored will take up less memory
> than the above.
> 
> your call !


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

Date: Fri, 09 Nov 2001 14:59:17 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: repeated string
Message-Id: <3bebef43.5a60$260@news.op.net>

In article <21916d9f.0111081100.34a2f06d@posting.google.com>,
Houda Araj <Houda.Araj@cogmedia.com> wrote:
>I have a file that I want a perl script to (1) read, (2) find all
>identical repeated strings within that file and (3) mark the repeated
>strings with <>

Are you sure you mean *all* repeated strings?

For example, if the file contained

        hello

would you want to mark it:

        hel<l>o

because 'l' has already appeared?

Can you give a short example that shows what you mean?

-- 
@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: Fri, 09 Nov 2001 15:07:58 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: repeated string
Message-Id: <slrn9unpms.mp9.tadmc@tadmc26.august.net>

Houda Araj <houda.araj@cogmedia.com> wrote:
>> > I have a file that I want a perl script to (1) read, (2) find all
>> > identical repeated strings within that file and (3) mark the repeated
>> > strings with <>
>> > Any info is appreciated. Thanks!
>> 
>> How large is the file ?
>
>The file is about 20 pages. 


What is a "page"?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 09 Nov 2001 15:54:01 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: Shift Operators - newbie
Message-Id: <t_SG7.116314$tb2.9116882@bin2.nnrp.aus1.giganews.com>

I am trying to parse through someone else's code because modifications need
to be made to the script.  I am having trouble understanding how the shift
operator works.  In laymens terms I mean...i have the Programming Perl's
interpretation on it.    The examples given are:

1 << 4;  # Returns 16
32 >> 4; # Returns 2

The portion I am parsing through is:
if($#remotetcsbpfiles>>0){@xferlist=buildxferlist(@remotetcsbpfiles)};

The logic of how it is getting the return value is primarily what I am
looking for.  I appreciate the help.





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

Date: Fri, 09 Nov 2001 16:04:06 GMT
From: "Ron Hartikka" <ronh@iainc.com>
Subject: Re: Shift Operators - newbie
Message-Id: <W7TG7.966$oM5.77821@typhoon.mw.mediaone.net>

$#remottcsbpfiles>>0 does nothing

Isn't it ...$#remottcsbpfiles > 0... or shouldn't it be?


"Jessica Bull" <jessica.bull@broadwing.com> wrote in message
news:t_SG7.116314$tb2.9116882@bin2.nnrp.aus1.giganews.com...
> I am trying to parse through someone else's code because modifications
need
> to be made to the script.  I am having trouble understanding how the shift
> operator works.  In laymens terms I mean...i have the Programming Perl's
> interpretation on it.    The examples given are:
>
> 1 << 4;  # Returns 16
> 32 >> 4; # Returns 2
>
> The portion I am parsing through is:
> if($#remotetcsbpfiles>>0){@xferlist=buildxferlist(@remotetcsbpfiles)};
>
> The logic of how it is getting the return value is primarily what I am
> looking for.  I appreciate the help.
>
>
>




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

Date: 9 Nov 2001 15:05:13 GMT
From: news@roaima.freeserve.co.uk
Subject: Re: Using TCP "keep alives" with IO::Socket
Message-Id: <3bebf0a9@news.netserv.net>

nokesja@netscape.net wrote:
> I've been scouring the internet, news, all the PerlFAQ's,
> PerlMonks, and every O'reilly book I have ... and I cannot
> find any article that discusses how to utilize the perl
> IO::Socket module and TCP 'keep-alives'.

> Can anyone help me shed some light on this?

perldoc IO::Socket::INET says refer to IO::Socket for options, which
says it unifies getsockopt(2) and setsockopt(2) as sockopt(). Trying man
2 setsockopt says refer to socket(7) for details, which finally shows
that SO_KEEPALIVE is indeed a valid option.

So, without trying it, and assuming your IP stack supports it, I would
imagine that calling sockopt(SO_KEEPALIVE,1) would solve your problem.

Have you tried this and does it work?
Chris


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

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


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