[12919] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 329 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 2 01:07:13 1999

Date: Sun, 1 Aug 1999 22:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 1 Aug 1999     Volume: 9 Number: 329

Today's topics:
    Re: ActivePerl Build 815 Setup Problem (NEED HELP) <pgalipo@cam.org>
    Re: ActivePerl Build 815 Setup Problem (NEED HELP) <pgalipo@cam.org>
    Re: binary data <uri@sysarch.com>
    Re: binary data (Larry Rosler)
    Re: Breaking things into modules (Hal Mounce)
    Re: Change relative links to absolute (Randal L. Schwartz)
    Re: chmod function (Martien Verbruggen)
    Re: chmod function (Abigail)
    Re: Confusion with the Schwartzian Transform used in so (Larry Rosler)
    Re: Confusion with the Schwartzian Transform used in so (Larry Rosler)
    Re: Confusion with the Schwartzian Transform used in so (Abigail)
    Re: external file access (Larry Rosler)
        How to access only last field of a split ? <john@hendigital.com.au>
    Re: How to access only last field of a split ? (elephant)
    Re: How to access only last field of a split ? <cfwu@slugger.ee.nthu.edu.tw>
    Re: How to compare two files and get the differences ? (Larry Rosler)
    Re: Just Can't, Can't get Net::Telnet to work (Martien Verbruggen)
    Re: newbie Q (was <Re: Help opening a file>) (Larry Rosler)
    Re: Newbie Simple Question (Tad McClellan)
        parallel output/input socket <yms5000@yahoo.com>
    Re: perl compiler wanted (Martien Verbruggen)
    Re: perl compiler wanted (Abigail)
        Stripping off headers from email <ararat@earthlink.net>
    Re: Stripping off headers from email <tchrist@mox.perl.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Sun, 01 Aug 1999 23:53:01 -0400
From: Philippe Galipeau <pgalipo@cam.org>
To: "Brett Dickson <> brett.dickson@clear.net.nz" <@cam.org>
Subject: Re: ActivePerl Build 815 Setup Problem (NEED HELP)
Message-Id: <37A5161B.1F5EF716@cam.org>

Thanks

You are right on the nose. I guest that I was impacient. Thanks for the advice
of waiting. I did and it took 10 to 15 min. in order to complet the
installation.


"Brett Dickson <> brett.dickson@clear.net.nz" wrote:

> Towards the end of the setp procedure for ActivePerl it creates documation
> for the install, etc.  When it says that it may take several minutes, it
> really means it (5-10 minutes on a slow computer).
>
> ____________
> Brett Dickson.



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

Date: Sun, 01 Aug 1999 23:53:44 -0400
From: Philippe Galipeau <pgalipo@cam.org>
To: brett.dickson@clear.net.nz
Subject: Re: ActivePerl Build 815 Setup Problem (NEED HELP)
Message-Id: <37A51646.DE529A6C@cam.org>

Thanks

You are right on the nose. I guest that I was impacient. Thanks for the advice
of waiting. I did and it took 10 to 15 min. in order to complet the
installation.


"Brett Dickson <> brett.dickson@clear.net.nz" wrote:

> Towards the end of the setp procedure for ActivePerl it creates documation
> for the install, etc.  When it says that it may take several minutes, it
> really means it (5-10 minutes on a slow computer).
>
> ____________
> Brett Dickson.



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

Date: 01 Aug 1999 23:06:30 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: binary data
Message-Id: <x7zp0alw3t.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

  A> Giorgos Zervas (giorgos@perlfect.com) wrote on MMCLXII September MCMXCIII
  A> in <URL:news:37A510C7.51D7D683@perlfect.com>:
  A> ~~ 
  A> ~~ Could someone explain to me why when reading binary data with read and
  A> ~~ sysread the data appears in different order? 

  A> I don't think it does. What makes you think it does? (Where's your code?)

  A> ~~ Which one should I use to read binary data from a file?

  A> That depends.

  A> ~~ Perlfect Solutions
  A> ~~ http://perlfect.com

  A> Maybe there's someone in your team of "expert perl programmers who have
  A> profound knowledge" that knows the difference between read and sysread?

i wouldn't call them "expert perl whatevers". here is some sample code
from a free script they offer. it has no matt viruses and actually uses
cgi.pm but it is pretty bad on its own:

 while (<FILE>) {
      chomp;
      $_ =~ s/(\#.*)//g;    #ingore comments

why /g?

note the lovely use of $_ =~ and the poor choice of delimiters.


$buffer =~ s/[\n\s]+/ /gs;

that one is fun. \s has \n in it. and /s is not needed as . is not in
the regex. and tr/// would be faster.



  while (<FILE>) {
    chomp;
    push @stopwords, $_;
  }
}

that could be done with
	chomp( @stopwords = <FILE> ) ;

many variables are upper case.

i won't show any more but it is all the same vintage. 

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Sun, 1 Aug 1999 21:57:07 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: binary data
Message-Id: <MPG.120ec4fcc161d3b4989d92@nntp.hpl.hp.com>

In article <x7zp0alw3t.fsf@home.sysarch.com> on 01 Aug 1999 23:06:30 -
0400, Uri Guttman <uri@sysarch.com> says...
 ...
>       $_ =~ s/(\#.*)//g;    #ingore comments
> 
> why /g?
> 
> note the lovely use of $_ =~ and the poor choice of delimiters.

I don't see anything wrong with the choice of delimiters.  I don't like 
the backslash before the '#', though.  Or the useless parentheses.  And 
out of context, I wonder if it's Perl they're parsing and don't know 
about all the other places '#' may be found.

And my comment would be 'gore in 2000', not 'ingore'.  :-)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 01 Aug 1999 21:09:36 -0700
From: hal@mounce.com (Hal Mounce)
Subject: Re: Breaking things into modules
Message-Id: <hal-0108992109370001@halm.vip.best.com>

In article <37A14D5A.304F392A@mail.cor.epa.gov>, David Cassell
<cassell@mail.cor.epa.gov> wrote:


> I like:
>     @EXPORT = qw/list $of &names %to @export/;
> as in
>     @EXPORT = qw/ &mysub $omething @nother_thing /;
>                   ^^^^^
> 

> Okay, here's the shortest bit of code I could find that illustrates
> this:
> 

--snip--

Hey, like thanks a bunch.  I think I can figure things out now.

Lemme know if you ever run into a mainframe you need beat into submission.

Hal


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

Date: 01 Aug 1999 19:18:17 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Change relative links to absolute
Message-Id: <m1so63udqu.fsf@halfdome.holdit.com>

>>>>> "mark" == mark  <mark@bstar.net> writes:

mark> I've got a variable that holds one whole HTML page in it.
mark> I'd like to convert all the relative links in it to absolute links (but
mark> not mess with the already absolute links)
mark> I can specify the 'home' directory ie
mark> $homedir = "http://www.mydomain.com/thisiswhereitshouldbelooking/";

mark> Someone -must- have this code somewhere so I don't have to spend the
mark> time redoing it! :)

One of my WT columns does something like that.  See "Tarring up the directory
tree" under

	http://www.stonehenge.com/merlyn/WebTechniques/

for details.

print "Just another web-Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Mon, 02 Aug 1999 02:21:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: chmod function
Message-Id: <Bg7p3.137$yJ1.7087@nsw.nnrp.telstra.net>

In article <37a4fd7b.35376619@news5.bellatlantic.net>,
	abc@abc.net (NiteFever) writes:

> $OrignialLogFile = 'sample.txt'
> chmod (0770, $OrignialLogFile)
> 
> What won't this work?
  Why

Because this won't compile. There are no semicolons at the end of your
lines.

If this is not your real code, then maybe you should try something
like:

$OrignialLogFile = 'sample.txt';
chmod( 0770, $OrignialLogFile ) || warn "Couldn't chmod $OrignialLogFile: $!";

and your program will tell you why chmod didn't work.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | The gene pool could use a little
Commercial Dynamics Pty. Ltd.       | chlorine.
NSW, Australia                      | 


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

Date: 1 Aug 1999 22:37:16 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: chmod function
Message-Id: <slrn7qa4i9.psl.abigail@alexandra.delanet.com>

NiteFever (abc@abc.net) wrote on MMCLXII September MCMXCIII in
<URL:news:37a4fd7b.35376619@news5.bellatlantic.net>:
^^ I'm tring to make this work:
^^ 
^^ $OrignialLogFile = 'sample.txt'
^^ ..
^^ ..
^^ ..
^^ ..
^^ chmod (0770, $OrignialLogFile)
^^ 
^^ What won't this work?


What do you mean by "won't this work"? If you are doing this to
find the sum of 17 and 23, then the answer is: because you didn't
use ``+''.

If you don't tell us what you expect to happen, and what actually
happened, how are we going to guess what's wrong?

[Of course, you could mean that "sample.txt" didn't get permission 0770
 for some reason, but that's less likely than winning the lottery 37
 times in a row without ever buying a ticket. You are clearly not at all
 interesting in whether the chmod actually succeeds or not, else something
 would have followed the chmod. But nothing is following it.]


Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sun, 1 Aug 1999 19:30:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Confusion with the Schwartzian Transform used in sorting
Message-Id: <MPG.120ea293fc3bb65b989d8b@nntp.hpl.hp.com>

In article <rq9e1m4i501cq6@corp.supernews.com> on Sun, 1 Aug 1999 
14:12:20 -0700, meteorman <twade@nobmispam.net> says...
+ Anno and others,
+ 
+ I really appreciate all the comments and suggestions.  I still don't
+ have these transforms down pat yet, but I'm getting there.  Here is my
+ version so far.  Is it correct now?   I am still having a difficult
+ time trying to figure out what is going on internally.   I
+ understand the concept do but not know how map is storing the data
+ internally.  This is where I am getting
+ lost.  Would anyone be willing to explain it in detail?

http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html

+ ///////////////// here is a sample of the data file
+ Iron Mountain,spot1.html
+ Badger Butte,spot2.html
+ Anthony Lakes,spot3.html
+ Badger Butte Lake,spot4.html
+ 
+ ///////////////////  here is the script
+ open LIST, ">c:\\temp\\fws_list" || die "Couldn't open file. $!\n";
+ 
+ @by_spotname =
+   map { $_->[0] }
+   sort { $a->[0] cmp $b->[0] }

Change the zeroes in the line above to ones.  You want to sort by the 
second element of the anonymous arrays.

+   map { [$_, (split /,/)[0]] }
+   <LIST>;

This still can't be right, because you are trying to read (<LIST>) from 
a file opened for output (">c:\\temp\\fws_list", which was my third best 
suggestion for how to fix your quoting problem).

+ close LIST;
+ 
+ This version compiles without any problems on the command line us 
+ '-w', unlike the previous attempt.  However, I am still unsure how to
+ "see" if the data is correct.  Several of you mentioned renaming the
+ file and then storing to the original file.  Since I am just starting
+ perl, probably obvious, I have not used this technique.  Could some
+ one show me an example.

perlfaq5: "How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the
beginning of a file?"

+ Thanks again for all your time and help,

'Have the Appropriate Amount of Fun!' -- Larry Wall

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 1 Aug 1999 20:49:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Confusion with the Schwartzian Transform used in sorting
Message-Id: <MPG.120eb53dcec1c0b4989d8e@nntp.hpl.hp.com>

In article <37A4F982.BDED3AF3@prism.gatech.edu> on Sun, 01 Aug 1999 
21:50:58 -0400, andy barfoot <gt7202e@prism.gatech.edu> says...

<SNIP useful stuff about breaking down the Schwartzian Transform>

> Of course, there's another way to sort:
> 
> 	my @stuff = <LIST>;
> 	my %places = ();
> 	foreach (@stuff) {
> 		$places{$_} = (split /,/)[0];
> 	}
> 	print sort { $places{$a} cmp $places{$b} } @stuff;

There are several other ways to sort, with varing degrees of efficiency.  
What you show here, Uri Guttman and I call the 'cached sort' in our 
paper, <URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>.  Its 
disadvantage is requiring two passes over the input data, as you show.  
That can be avoided using the 'Orcish Maneuver':

  	my %places;
  	print sort { ($places{$a} ||= (split /,/, $a)[0])
               cmp ($places{$b} ||= (split /,/, $b)[0])
                 } <LIST>;

Then there is the Schwartzian Transform, and finally the 'packed-
default' sort, for the best speed that Perl can provide.  All in the 
above reference.

In this case, the packed-default sort looks like this:

  	print map  { substr $_, 1 + index $_, "\0" }
            sort
            map  { (split /,/)[0] . "\0$_" } <LIST>;

Once you get the hang of it, that's not any harder to write than the 
Schwartzian Transform.  And there is a new module to make it easier, 
even for more complicated sorts than this simple one.

The speed advantage arises because the default sort (no sortsub) is much 
faster than sorting with a sortsub.  Read all about it, and benchmark it 
yourselves.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 1 Aug 1999 23:53:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Confusion with the Schwartzian Transform used in sorting
Message-Id: <slrn7qa91i.q17.abigail@alexandra.delanet.com>

Larry Rosler (lr@hpl.hp.com) wrote on MMCLXII September MCMXCIII in
<URL:news:MPG.120eb53dcec1c0b4989d8e@nntp.hpl.hp.com>:
^^ 
^^ Then there is the Schwartzian Transform, and finally the 'packed-
^^ default' sort, for the best speed that Perl can provide.  All in the 
^^ above reference.
^^ 
^^ In this case, the packed-default sort looks like this:
^^ 
^^   	print map  { substr $_, 1 + index $_, "\0" }
^^             sort
^^             map  { (split /,/)[0] . "\0$_" } <LIST>;


One would expect a possible speedup (not much though) by using 
(split /,/ => $_ => 2)[0]. The speedup will of course only be
there if there are many ,'s on the lines.



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sun, 1 Aug 1999 21:12:01 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: external file access
Message-Id: <MPG.120eba6f37088de3989d8f@nntp.hpl.hp.com>

In article <7o2m8r$jcj$1@nnrp1.deja.com> on Sun, 01 Aug 1999 23:46:36 
GMT, makarand_kulkarni@my-deja.com <makarand_kulkarni@my-deja.com> 
says...
[using Jeopardy style, so we can't see what he is responding to until 
later]
> 
> Let us assume that you have
> the valid options in entries.txt
> ( one option on each line..)
> Code -- something like this..
> Also let us assume that
> the user will either type
> a valid option or "end"
> to indicate that he is ending his
> interactive 'session'.

Is something seriously wrong with your line wrapping?  The latest 
Deja.com horror.

> #!/usr/local/bin/perl5 -w
> 
> open ( F, "entries.txt" ) || die ;
> @entries = <F> ;
> chomp @entries ;
> 
> while ( 1)
> {

Please indent the bodies of loops or other blocks.

> $response= <STDIN> ;

You don't deal with the user generating end-of-file.

> chop $response ;

'chomp' was right above, and should be here also.  But you don't really 
need to chomp ether place in this simple situation, with appropriate 
changes below.

> next if ( length ( $response )  < 1  ) ;
> last if ( $response  eq "end" )  ;
> last if ( grep ( $_ eq  $response , @entries) ) ;
> # else tell user what the valid options are..
> print " your valid options are " . join ( " ",  @entries ). "\n" ;
> }

Even though it hardly matters when the inputs are coming in one at a 
time at user-generated speed and when the valid options are few enough 
to be printed out on one line, code like this shouldn't go unremarked, 
lest others think it should be used in a real program.  Here's what 
perlfaq4: "How can I tell whether a list or array contains a certain 
element?" has to say about it:

 ...

Please do not use 

    $is_there = grep $_ eq $whatever, @array;

 ...

And it tells how to do it correctly.  See Eric Bohlman's succinct 
response in this thread:  'use a hash'!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 2 Aug 1999 11:34:40 -0800
From: "John Hennessy" <john@hendigital.com.au>
Subject: How to access only last field of a split ?
Message-Id: <01bedc97$7a0d0a80$f34f39cb@stingray>

Hi, I am wanting to access only the last field of a split line.
Is there a quick way of doing this keeping in mind I won't know
how many fields will be returned in the line.

Example line...

word.10.word.20.30.40.50


Thanks

John.


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

Date: Mon, 2 Aug 1999 14:16:03 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: How to access only last field of a split ?
Message-Id: <MPG.120fc69048a9204e989bac@news-server>

John Hennessy writes ..
>Is there a quick way of doing this keeping in mind I won't know
>how many fields will be returned in the line.
-
>word.10.word.20.30.40.50

don't know about using split in this sort of circumstance .. how about 
just a regex with something like this

  my $sep = '.';	# assuming you meant to split on the period
  $_ = 'word.10.word.20.30.40.50';
  my $last = /\Q$sep\E([^$sep]+)$/ ? $1 : '';

-- 
 jason - remove all hyphens for email reply -


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

Date: 2 Aug 1999 04:35:36 GMT
From: Chi-Feng Wu <cfwu@slugger.ee.nthu.edu.tw>
Subject: Re: How to access only last field of a split ?
Message-Id: <7o376o$2p9$1@news.ee.nthu.edu.tw>

John Hennessy  <john@hendigital.com.au> wrote:
: Hi, I am wanting to access only the last field of a split line.
: Is there a quick way of doing this keeping in mind I won't know
: how many fields will be returned in the line.
: Example line...
: word.10.word.20.30.40.50

  while (<>) {
    print((split /\./)[-1]);
  }

  # -1 is the index to the last element
 
--
cfwu


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

Date: Sun, 1 Aug 1999 20:03:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to compare two files and get the differences ?
Message-Id: <MPG.120eaa4371e2db9d989d8c@nntp.hpl.hp.com>

In article <7o25oc$jfb$1@news.ml.com> on 1 Aug 1999 19:04:44 GMT, 
Michael Wang <mwang@tech.cicg.ml.com> says...
> Yeong Mo/Director Hana co. <factory@factory.co.kr> wrote:
> >aaa.txt has the following lines;
> >f1, 123, .........
> >f2, 222, .........
> >f3, 5555, .......
> >f4, xxx, ........
> >....................
> >
> >and bbb.txt has the following lines;
> >f2, 222, ...........
> >f3, 5555, .........
> >......................
> 
> I would just go with 
> system("diff aaa.txt bbb.txt"); or
> `diff "aaa.txt" "bbb.text"`
> 
> It is diff's job. 

Only if the data must be in the specified sequence.  For arbitrarily 
ordered input that won't work at all.  And there is no indication of 
ordering in the original question.

perlfaq4: "How do I compute the difference of two arrays? How do I
compute the intersection of two arrays?"

That 'difference' is the 'symmetric difference'.  See also this thread:

http://x36.deja.com/[ST_rn=ps]/viewthread.xp?AN=488495856

which contains code and references to the Perl Cookbook for simple set 
difference.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 02 Aug 1999 02:56:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Just Can't, Can't get Net::Telnet to work
Message-Id: <XN7p3.148$yJ1.8106@nsw.nnrp.telstra.net>

In article <7o1i1n$dg4$1@phys-ma.sol.co.uk>,
	"Colin Chaplin" <Colin@Chaplin.sol.co.uk> writes:

> Just about. The command prompt is set to
> ()

Your command prompt is '()'? What an odd choice.

> #/bin/perl5 --*-perl-*-
> use Net::Telnet;
> $username = 'root';
> $passwd = 'yeahright';
> $sparky = new Net::Telnet (Host => "localhost",
>                                Timeout => 10,
>       Prompt => '/()/');

Brackets in a regexp are special. If your command prompt really is
'()', then you should do something like:

$sparky = new Net::Telnet (
	Host => "localhost", 
	Timeout => 10, 
	Prompt => '/\(\)/'
);

> Right, why do we get this then ?

I hate to say this, but, it works fine for me. Almost unmodified,
except for the odd prompt that you decided to use.

It's funny, because the Net::Telnet module says:

# perldoc Net::Telnet
[snip]
     o To avoid unexpected backslash interpretation, always use
       single quotes instead of double quotes to construct a
       match operator argument for prompt() and waitfor() (e.g.
       '/bash\$ $/').  If you're constructing a DOS like file
       path, you'll need to use four backslashes to represent one
       (e.g. '/c:\\\\users\\\\bill>$/i').

       Of course don't forget about regexp metacharacters like .,
       [, or $.  You'll only need a single backslash to quote
       them.  The anchor metacharacters ^ and $ refer to
       positions in the input buffer.
[snip]

Now.. It doesn't mention '(' and ')' explicitly, but the perlre man
page does.

# perldoc perlre
[snip]
     In particular the following metacharacters have their
     standard egrep-ish meanings:
[snip]
         ()  Grouping
[snip]

> The sequence of these appears to be random. I  had to modify the module as
> it expected the password prompt to be password: when it is actually
> Password: (it didn't allow for cap P).

Not true. From the source:

    ## Wait for password prompt.
    $self->waitfor(-match => '/password[: ]*$/i')

see the /i?

>                                        I am starting to loose faith in that
> module and begging to think it isn't just my dodgy coding at fault.

You're wrong there. The module may not be perfect, but it works fine
for many things that I have used it for. I suspect it may have
something to do with your coding.

> Has anyone done this before ? All I want to do is to automate a telnet that
> zips up a file

I probably wouldn't use a telnet for this, but a rsh. I would probably
not write a perl program to do this, but a tiny shell script.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.       | from a rich salesperson.
NSW, Australia                      | 


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

Date: Sun, 1 Aug 1999 20:14:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie Q (was <Re: Help opening a file>)
Message-Id: <MPG.120eacf46f695951989d8d@nntp.hpl.hp.com>

In article <37A4EEF8.6C405211@dds.nl> on Mon, 02 Aug 1999 03:06:00 
+0200, Niek Slatius <nslatius@dds.nl> says...
> Anno Siegel wrote:
> > Please don't advise people to read a whole file into an array without
> > reason.  Instead of looping over the array, this does the very same
> > thing (except for the chomp I've added) and is more conservative in
> > memory usage:
> 
> Is memory usage the only good reason for not 'putting files into arrays' to much?
> Or are there more good reasons (e.g. execution speed of the script)?

Instead of being processed 'on the fly', each line of input has to be 
copied into the array for later retrieval.  Also, growing an array line 
by line may involve several reallocations and copying of lists of 
pointers to the data lines.  (The array can be preallocated to avoid 
that overhead, but not the actual copying of the data.)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 1 Aug 1999 17:53:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie Simple Question
Message-Id: <hkf2o7.9b3.ln@magna.metronet.com>

NiteFever (abc@abc.net) wrote:

: How do I pass file name into my perl script?
: Example..

: someperlfile file1 file2


   Just like that is how you pass arguments into a perl script!


: Where "someperfile" is the name of the perl script and "file1" &
: "file2" are the files I want to pass to "someperfile".

: Any help would be great...thanks in advance


   I think perhaps you wanted to ask a different question.

   Something like:

      "how do I access the arguments from within the script?"

   maybe?


   If so, then see "@ARGV" in perlvar.pod.


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


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

Date: Mon, 2 Aug 1999 10:11:36 +0800
From: "YMS" <yms5000@yahoo.com>
Subject: parallel output/input socket
Message-Id: <7o2vfl$glp@netnews.hinet.net>


Hi experts,

I have read the IO::Select manpage and FAQ about IO as well.  But i still
failed in the code such that:

 .continuously get the message from the socket
 .send message from STDIN to the socket if any line in STDIN

Any demo code?  My OS is NT4.0 and running ActivePerl.






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

Date: Mon, 02 Aug 1999 02:16:17 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: perl compiler wanted
Message-Id: <Rb7p3.133$yJ1.7087@nsw.nnrp.telstra.net>

In article <7o2slb$o0195@atbhp.corpmel.bhp.com.au>,
	"Saugato Mukerji" <Mukerji.Saugato.S@bhp.com.au> writes:
> does anybody know of a perl compiler which will compile
> the .pl source into an exeucutable on NT, unix.
> 
> The idea is to be able to distribute the perl application without
> having to give away the source.

Ugh. Not again.

People like this really test my patience.

Read the archives of this newsgroup on deja.com or somewhere else.
read the FAQ. Both should give you many things to think about.

# perldoc perlfaq3
     How can I compile my Perl program into byte code or C?

Next time, do some work before posting, ok?

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | 
Commercial Dynamics Pty. Ltd.       | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                      | 


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

Date: 1 Aug 1999 22:40:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: perl compiler wanted
Message-Id: <slrn7qa4nf.psl.abigail@alexandra.delanet.com>

Saugato Mukerji (Mukerji.Saugato.S@bhp.com.au) wrote on MMCLXII September
MCMXCIII in <URL:news:7o2slb$o0195@atbhp.corpmel.bhp.com.au>:
|| 
|| does anybody know of a perl compiler which will compile
|| the .pl source into an exeucutable on NT, unix.

RTFFAQ.

|| The idea is to be able to distribute the perl application without
|| having to give away the source.

Read the FAQ to see why that doesn't help.

It's better not to do business with criminals.



Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sun, 01 Aug 1999 19:17:57 -0700
From: Ovanes Manucharyan <ararat@earthlink.net>
Subject: Stripping off headers from email
Message-Id: <37A4FFD5.9EAD2DF1@earthlink.net>

How can I easily remove all headers from a file
which is a single email message.. Please reply
via email.

Thanks in advance



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

Date: 1 Aug 1999 20:32:58 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Stripping off headers from email
Message-Id: <37a5035a@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Ovanes Manucharyan <ararat@earthlink.net> writes:
:How can I easily remove all headers from a file
:which is a single email message.. Please reply
:via email.

% perl -i.orig -ne 'print unless 1 .. ?^$?' onefilenamehere

--tom
-- 
    double value;                /* or your money back! */
    short changed;               /* so triple your money back! */
            --Larry Wall in cons.c from the 4.0 perl source code


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 329
*************************************


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