[8506] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2123 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 18 02:07:38 1998

Date: Tue, 17 Mar 98 23:00:31 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 17 Mar 1998     Volume: 8 Number: 2123

Today's topics:
    Re: /URGENT/ Problems w/ PERL for IIS 4.0 <ckengche@dso.org.sg>
    Re: ? retrieve meta tag information from a HTML documen (Martin Vorlaender)
    Re: Bitwise? <jdludlow@millcomm.com>
    Re: Bitwise? <jdludlow@millcomm.com>
    Re: calculating distance between strings (fortune cooki <rjk@coos.dartmouth.edu>
        Directory Size - Perl for NT (Mr RD Mcgowan)
    Re: how to slice an anonymous hash? <rjk@coos.dartmouth.edu>
        Image capture/send with Linux/Perl <johnrc@gointeract.com>
    Re: Need a perl function (A. Deckers)
    Re: Need help parsing a text file <jdf@pobox.com>
    Re: Need help parsing a text file <jdf@pobox.com>
    Re: Need help parsing a text file <jdf@pobox.com>
        Perl 5.004 install problem <greyfld@ix.netcom.com>
        Perl on IIS (Ieong Sze Chung Ricci)
    Re: removing everything between < and > <rjk@coos.dartmouth.edu>
    Re: VERY URGENT !!! (Jim Britain)
    Re: VERY URGENT !!! <jdludlow@millcomm.com>
    Re: Why this one doesn't work ? <rjk@coos.dartmouth.edu>
    Re: Why this one doesn't work ? (Neil Schemenauer)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 18 Mar 1998 12:32:56 +0800
From: Chuang Keng Chee <ckengche@dso.org.sg>
Subject: Re: /URGENT/ Problems w/ PERL for IIS 4.0
Message-Id: <350F4E77.576F7A49@dso.org.sg>

Hi!

I've got problems with Perl5.004 running on NT4.0 Server and IIS4.0 too!
Sorry
for not being able to help in this case :)  One of the "problems" solved for
me any
way is that initially I didn't know I had to associate .pl files with the
Perl executable
on one of the tabs in the MMC.  I've spent about two weeks trying to get my
scripts
that worked on IIS3.0 to work on IIS4.0.  The error message I get now is :
Website
Found.  Waiting for reply. !!

I've abandoned the effort for now and reverted to using a C program (a 120K
exe
compared to about 1K Perl Script!!) to do the job.  Any help on this would
certainly
be appreciated.

P.S.  Anyone ever encountered this :  The IE4.01 browser prompting the user
where
        he wants to save a Perl script CGI instead of telling the web server
to execute it ?

J.D. Beary wrote:




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

Date: Wed, 18 Mar 1998 06:45:20 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: ? retrieve meta tag information from a HTML document with Perl ?
Message-Id: <350f5f70.524144494f47414741@radiogaga.harz.de>

Peter Perchansky (fp@pmpcs.com) wrote:
: Martin Vorlaender wrote...
: >It might be overkill for this purpose, but have a look at the
: >HTML::Parser module, which is part of the LWP.

: I'm reading Web Client Programming (it goes over LWP and HTML::Parse et
: all).  However, I'm having an interesting time find really good
: documentation on the various modules ("Web Client Programming" skips some).

: Do you know of any books or web sites that really go over HTML:Parse and the
: other modules that make up the LWP set?

Books: sorry, no info. Besides the Camel and the Panther, and the various
PODs that come with the LWP, I haven't looked at any.

Web Sites: You may want to look at Randal Schwartz' WebTechniques column at
http://www.stonehenge.com/WebTechniques/. He uses LWP modules all the time;
in particular in #7 and #14, he uses HTML::Parser to implement a link checker.

As it really is easy to utilize HTML::Parser for this, I hacked together
a quick solution. It should (even without comments - remembering one of the
virtues of a great programmer ;-) show the basics of how to do it.

Hope it helps,
  Martin

#!perl -w
use strict;

use HTML::Parser;

{
   package KeywordRetriever;

   @KeywordRetriever::ISA = qw(HTML::Parser);

   sub new {
      my $class = shift;
      my $self = $class->SUPER::new();
      $self->{KeywordContent} = '';
      bless $self, $class;
   }

   sub start {
      my ($self, $tag, $attr) = @_;

      if ($tag eq 'meta' &&
          ($attr->{'http-equiv'} =~ /^keywords$/i ||
           $attr->{name}         =~ /^keywords$/i)) {
         $self->{KeywordContent} = $attr->{content};
      }
   }
}

# ...read the HTML file into $contents...

my $k = new KeywordRetriever;
$k->parse( $contents );
$k->eof();

print $k->{KeywordContent};
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Wed, 18 Mar 1998 06:30:50 GMT
From: James Ludlow <jdludlow@millcomm.com>
Subject: Re: Bitwise?
Message-Id: <350F16B7.7A638684@millcomm.com>

rfonline@nbn.com wrote:
> 
> Greetings,

Hi.

> I have a set of "items," which are represented by a series of 0s and
> 1s.  For example, an item might look like this:
> 
> 10011
> 
> Each 0 or 1 stands for either yes or no on a series of
> characteristics.
> 
> I am comparing the items to see how "alike" they are, that is, how
> many characteristics they have in common.  For example:
> 
> 10011
> 00000
> 
> The above two items have two characteristics in common (the second and
> third).
> 
> I'm currently making my comparison with a for loop, which works just
> fine.  What I'm thinking, though, is that there must be some way, with
> perl's bitwise operators, to make the comparison much more efficiently
> -- or at least more elegantly!  I'm not really a programmer (perl is
> my first language), and I'm not very familliar with sophisticated
> bitwise idioms, so I'm kind of in the dark here.

Well, this was fun.  You didn't say so, but I'm assuming that the strings are
always the same length.

First of all, I did a for loop just as a frame of reference:

#!/usr/bin/perl -w

$string1 = "10101010101010";
$string2 = "01101101010101";

@string1 = split //, $string1;
@string2 = split //, $string2;
$count = 0;

for (@string1) {
    $count += ($_ == shift @string2);
}

print "count = $count\n";


Then I went for as close to a one liner as I could get.  Not using a while or
for loop made it very interesting, and I felt like I was jumping through the
same hoops over and over.  This is what I came up with.

#!/usr/bin/perl -w

$string1 = "10101010101010";
$string2 = "01011101010101";

$answer = 
split //,(join '', sort {$a <=> $b} split //, unpack "B*", (pack "B*",
$string1) ^ (pack "B*", $string2)) + 0.0; 

print "$answer\n";

The general idea is this:
1. XOR the two strings as binary numbers (see, I used a bitwise function :)
2. Count the number of 1's.

Now since I didn't want to use a for loop to count the 1's, I sorted the XOR'd
number to sift the 1's down to the least significant bits.  Then I stripped
the leading zeroes by adding 0.0, split the number into an array, and took the
length of the array.  My suggestion... use the for loop. ;)

--
James Ludlow (jdludlow@millcomm.com)


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

Date: Wed, 18 Mar 1998 06:40:34 GMT
From: James Ludlow <jdludlow@millcomm.com>
Subject: Re: Bitwise?
Message-Id: <350F1902.BECBBF81@millcomm.com>

James Ludlow wrote:
> 
> rfonline@nbn.com wrote:
> >

> Then I went for as close to a one liner as I could get.  Not using a while or
> for loop made it very interesting, and I felt like I was jumping through the
> same hoops over and over.  This is what I came up with.
> 
> #!/usr/bin/perl -w
> 
> $string1 = "10101010101010";
> $string2 = "01011101010101";
> 
> $answer =
> split //,(join '', sort {$a <=> $b} split //, unpack "B*", (pack "B*",
> $string1) ^ (pack "B*", $string2)) + 0.0;
> 
> print "$answer\n";
> 
> The general idea is this:
> 1. XOR the two strings as binary numbers (see, I used a bitwise function :)
> 2. Count the number of 1's.
> 
> Now since I didn't want to use a for loop to count the 1's, I sorted the XOR'd
> number to sift the 1's down to the least significant bits.  Then I stripped
> the leading zeroes by adding 0.0, split the number into an array, and took the
> length of the array.  My suggestion... use the for loop. ;)
> 
> --
> James Ludlow (jdludlow@millcomm.com)

Wow.  I worked so long on it that I forgot that you wanted the number of items
that were the same.  That script counts the number that are different, but the
concept is the same.

--
James Ludlow (jdludlow@millcomm.com)


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

Date: Wed, 18 Mar 1998 00:47:48 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Simon Oosthoek <s.oosthoek@student.utwente.nl>
Subject: Re: calculating distance between strings (fortune cookies)
Message-Id: <350F6008.6B836CED@coos.dartmouth.edu>

[posted and mailed]

Simon Oosthoek wrote:
> 
> sample code
> (this doesn't work (anymore, for me), no time now to find the bug, I'm a bit
> out of practice with Perl)

I might have time to find the bug, if you told me how it "doesn't work".  :-)

> #!/usr/bin/perl -w
> 
> open(FILE, "<$ARGV[0]");

Always check the return value of open()!

open(FILE, "<$ARGV[0]") or die "Unable to open $ARGV[0]: $!\n";

> @infile = <FILE>;
> close(FILE);
> 
> $allinone = join("", @infile);
> @cookies = split(/%/, $allinone);

{
  local $/;
  @cookies = split(/%/, <FILE>);
}


> foreach $cookie (@cookies)
> {
> #  $cookie =~ s/\n\n/\n/g;
>   $newlines = ($cookie =~ s/\n/\n/g);
>   $chars = ($cookie =~ s/(\S)/$1/g);
>   $bounds = ($cookie =~ s/\b//g);
>   $capitals = ($cookie =~ s/([A-Z])/$1/g);
>   $lower = ($cookie =~ s/([a-z])/$1/g);
>   $digits = ($cookie =~ s/(\d)/$1/g);

Ack!  Don't use s/// to count characters!  Use tr///!
Btw, since you're using =~ so many times, it might make sense to use $_ as
your foreach variable instead of $cookie.

$newlines = tr/\n//;
$chars =    tr/ \t\r\n//c;
$bounds =   s/\b//g;       # That one you can't do with tr
$capitals = tr/A-Z//;
$lower    = tr/a-z//;
$digits   = tr/0-9//;

>   push (@hashlist, [ ($capitals, $lower, '0'.$digits, $chars, $bounds,
> $newlines) ]);

Those inner parens are unnecessary.  Why do you concatenate $digits with '0'?

> }
> 
> $i = 0;
> foreach $entry (@hashlist)
> {
>   my $tmp = packthem(@{$hashlist[$i]});

Pass the arrayref itself and dereference it in the subroutine, it'll be more efficient.

>   push (@packedlist, $tmp);
>   $backref{$tmp} = $i;

Do you want fortunes with the same $tmp to refer to the same index?  They
could be different in ways other those calculated by packthem()...

>   $i++;
> }
> 
> foreach $entry (sort @packedlist)
> {
>   my $index = $backref{$entry};
>   print join("\t", @{$hashlist[$index]}) . "\n";
>   print $cookies[$index];

 ...and the one appearing latest in the file would be printed in place of
fortunes having the same $tmp.

I think the data structures you are using aren't quite suited to your needs.

> }
> 
> sub packthem {
>   my $tmp = '';
> 
>   foreach (@_)

Change that to

foreach (@{$_[0]})

per above suggestion.

>   {
>     my $ln = length($tmp);
>     $tmp .=  '0' x ( 6 - $ln ) . $_;

Hmm...  I'm pretty sure you meant $ln to be the length of $_?  The way you
have it, the first time through the loop the length of $tmp is 0, so $tmp gets
set to '000000' . $_;  After that, the length of $tmp is >= 6, so it just
concatenates $_.

@_ = (12, 34, 56);
$tmp = '00000012';
$tmp = '0000001234';
$tmp = '000000123456';

If you did mean length($_), then you have a poor man's sprintf:

$tmp .= sprintf '%06s', $_;

>   }

Or even replace the entire foreach loop with:

$tmp = sprintf '%06d' x @{$_[0]}, @{$_[0]};

(Assuming you're passing an arrayref instead of an array.)

>   return $tmp
> }

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 18 Mar 1998 05:16:47 GMT
From: ryan@mdw088.cc.monash.edu.au (Mr RD Mcgowan)
Subject: Directory Size - Perl for NT
Message-Id: <6enlbv$9m0$1@towncrier.cc.monash.edu.au>

Using perl, how do you determine the size of a directory?

Thanks! :)

Ryan
--------------------------------------------------------------------------
Ryan McGowan, 4th Year BCSE, Monash University.
Email: Ryan.McGowan@cc.monash.edu.au
WWW: http://www-personal.monash.edu.au/~ryan/


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

Date: Wed, 18 Mar 1998 01:14:39 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Sanjay Malunjkar <smalunjk@cisco.com>
Subject: Re: how to slice an anonymous hash?
Message-Id: <350F6654.7BC5BF7B@coos.dartmouth.edu>

[posted and mailed]

Sanjay Malunjkar wrote:
> 
> I am trying to slice an anonymous hash but havent succeeded so far...
> 
> ...
> 
> $_='F::Scot::L::Tiger::C::Company name';
> @h= @{split(/::/)}{'F','L'};
> print "slice of anonymous hash in h=@h";
> #expect Scot Tiger, instead get blank

You're not constructing an anonymous hash: you're using the result of
split(/::/) in a scalar context as a soft reference to a hash:

~> perl
use strict refs;
$_='F::Scot::L::Tiger::C::Company name';
@h= @{split(/::/)}{'F','L'};
Can't use string ("6") as a HASH ref while "strict refs" in use at - line 3.
~>

@h = @{ {split(/::/)} }{'F','L'};
        ^           ^

Note the use of {} to construct an anonymous hash.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Tue, 17 Mar 1998 21:46:01 -0800
From: Johnathan Craniston <johnrc@gointeract.com>
Subject: Image capture/send with Linux/Perl
Message-Id: <350F5F94.9A31D679@gointeract.com>

- Doing an image capture/send project with Linux/Perl.  Looking for
someone well versed in Linux/Perl to play a key role.
Silicon Valley resident preferred.

Inquiries -> johnrc@gointeract.com



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

Date: 18 Mar 1998 06:41:09 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: Need a perl function
Message-Id: <slrn6gur45.fpi.Alain.Deckers@bashful.rediris.es>

In <6emp5p$76k$1@nnrp1.dejanews.com>,
	wsayegh@lynx.neu.edu <wsayegh@lynx.neu.edu> wrote:
>Does anyone have a PERL function that reads the directory and lists all the
>files which are not hidden, ie the files which do not start with a ".", then
>stores them in an array

$perldoc -f readdir
=item readdir DIRHANDLE

Returns the next directory entry for a directory opened by opendir().
If used in a list context, returns all the rest of the entries in the
directory.  If there are no more entries, returns an undefined value in
a scalar context or a null list in a list context.

If you're planning to filetest the return values out of a readdir(), you'd
better prepend the directory in question.  Otherwise, because we didn't
chdir() there, it would have been testing the wrong file.

    opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
    @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
    closedir DIR;

You work out the rest.

Alain
-- 
Perl reference: <URL:http://reference.perl.com/>
 Perl language: <URL:http://language.perl.com/>
  Perl archive: <URL:http://www.perl.com/CPAN/>
      Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>


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

Date: 18 Mar 1998 00:18:43 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Need help parsing a text file
Message-Id: <lnu8o9u4.fsf@news.concentric.net>

Barry Brown <bbrown@sna.com> writes:

> * Program statements can span multiple lines.

That suggests the /s modifier, which causes . to match newlines.

> * Everything that's not contained withing %{ }% tags is considered text,
>   including newlines.

No problem.

> Because of these, simple pattern matching with .*? doesn't work, since
> "." never matches a newline. 

Have you read the perlre document?  The Camel book also covers the /s
modifier, and everything else about regexes.  But, since you're
especially interested, you might consider buying a copy of _Mastering
Regular Expressions_.

> (Side note: Programming Perl doesn't seem to explain how $1,
> $2, ... are assigned when parentheses are nested.)

Not so:  (blue Camel, pg. 65)

   Pairs of parentheses are numbered by counting left parentheses from
   the left.

> Is there an easier way?  Or will I just have to slog through it and
> maybe do something like split the file into an array of single
> characters with @arr = split('', $_) so I can walk through it a
> character at a time?

Rather than do that, you might want to look at some of the modules at
CPAN.  I *believe* that Parse::Lex and Parse::RecDescent modules may
be helpful to you.  But if you're not nesting those code delimiters,
then you can use regexes.  But you'll need to learn about
non-backreffing parens, and zero-width lookaheads.  Here's one way to
do what you're doing (note that if there's the possibility of such
constructs as \%{ in the strings, you'll need a substantially more
complicated regex):

    #!/usr/bin/perl -w
    my @prog = ();
    { local $/; $_ = <DATA>; }
    while ( m/
	    (?:\s*)       # trim leading whitespace
			  # either:
	    (%{)          # an opening delimiter, followed by
	    (?:\s*)       # some optional whitespace
	    (.*?)         # a bunch of stuff that's not the closing delimiter
	    \s*}%\s*      # eat the closing delimiter    
	    |             # or     
	    (.+?(?=%{|$)) # a bunch of stuff that's not a code delimiter or $
	   /gsx)
    {
      $2 and push(@prog, [STMT => $2]), next;
      $3 and push(@prog, [TEXT => $3]);
    }
    foreach (@prog) {
      (my $text = $_->[1]) =~ s/\n/\\n/g;  #show newlines
      print "[$_->[0], $text]\n"
    }
    __DATA__
    Some text
    %{ statement 1 }%
    Some more
    text
    %{ statement 2}%%{ statement 3 }%
    %{multi-line
    statement 4}%text%{ statement 5 }%

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 18 Mar 1998 00:50:57 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Need help parsing a text file
Message-Id: <k99so8ce.fsf@news.concentric.net>


> * Program statements can span multiple lines.

That suggests the /s modifier, which causes . to match newlines.

> * Everything that's not contained withing %{ }% tags is considered text,
>   including newlines.

No problem.

> Because of these, simple pattern matching with .*? doesn't work, since
> "." never matches a newline. 

Have you read the perlre document?  The Camel book also covers the /s
modifier, and everything else about regexes.  But, since you're
especially interested, you might consider buying a copy of _Mastering
Regular Expressions_.

> (Side note: Programming Perl doesn't seem to explain how $1,
> $2, ... are assigned when parentheses are nested.)

Not so:  (blue Camel, pg. 65)

   Pairs of parentheses are numbered by counting left parentheses from
   the left.

> Is there an easier way?  Or will I just have to slog through it and
> maybe do something like split the file into an array of single
> characters with @arr = split('', $_) so I can walk through it a
> character at a time?

Rather than do that, you might want to look at some of the modules at
CPAN.  I *believe* that Parse::Lex and Parse::RecDescent modules may
be helpful to you.  But if you're not nesting those code delimiters,
then you can use regexes.  But you'll need to learn about
non-backreffing parens, and zero-width lookaheads.  Here's one way to
do what you're doing (note that if there's the possibility of such
constructs as \%{ in the strings, you'll need a substantially more
complicated regex):

    #!/usr/bin/perl -w
    my @prog = ();
    { local $/; $_ = <DATA>; }
    while ( m/            # match either:
	    %{\s*         # an opening delimiter
            (.*?)         # a bunch of stuff that's not the closing delimiter
            \s*}%         # eat the closing delimiter    
	    |             #         or     
	    (.+?(?=%{|$)) # a bunch of stuff that's not a code delimiter or $
           /gsx)

    {
      $1 and push(@prog, [STMT => $1]), next;
      $2 and push(@prog, [TEXT => $2]);
    }
    foreach (@prog) {
      (my $text = $_->[1]) =~ s/\n/\\n/g;  #show newlines
      print qq([$_->[0], "$text"]\n)
    }
    __DATA__
    Some text
    %{ statement 1 }%
    Some more
    text
    %{ statement 2}%%{ statement 3 }%
    %{multi-line
    statement 4}%text%{ statement 5 }%

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 18 Mar 1998 00:58:39 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Need help parsing a text file
Message-Id: <iupco7zk.fsf@news.concentric.net>

Barry Brown <bbrown@sna.com> writes:

> * Program statements can span multiple lines.

That suggests the /s modifier, which causes . to match newlines.

> * Everything that's not contained withing %{ }% tags is considered text,
>   including newlines.

No problem.

> Because of these, simple pattern matching with .*? doesn't work, since
> "." never matches a newline. 

Have you read the perlre document?  The Camel book also covers the /s
modifier, and everything else about regexes.  But, since you're
especially interested, you might consider buying a copy of _Mastering
Regular Expressions_.

> (Side note: Programming Perl doesn't seem to explain how $1,
> $2, ... are assigned when parentheses are nested.)

Not so:  (blue Camel, pg. 65)

   Pairs of parentheses are numbered by counting left parentheses from
   the left.

> Is there an easier way?  Or will I just have to slog through it and
> maybe do something like split the file into an array of single
> characters with @arr = split('', $_) so I can walk through it a
> character at a time?

Rather than do that, you might want to look at some of the modules at
CPAN.  I *believe* that Parse::Lex and Parse::RecDescent modules may
be helpful to you.  But if you're not nesting those code delimiters,
then you can use regexes.  But you'll need to learn about
non-backreffing parens, and zero-width lookaheads.  Here's one way to
do what you're doing (note that if there's the possibility of such
constructs as \%{ in the strings, you'll need a substantially more
complicated regex):

    #!/usr/bin/perl -w
    my @prog = ();
    { local $/; $_ = <DATA>; }
    while ( m/
	    (?:\s*)       # trim leading whitespace
			  # either:
	    (%{)          # an opening delimiter, followed by
	    (?:\s*)       # some optional whitespace
	    (.*?)         # a bunch of stuff that's not the closing delimiter
	    \s*}%\s*      # eat the closing delimiter    
	    |             # or     
	    (.+?(?=%{|$)) # a bunch of stuff that's not a code delimiter or $
	   /gsx)
    {
      $2 and push(@prog, [STMT => $2]), next;
      $3 and push(@prog, [TEXT => $3]);
    }
    foreach (@prog) {
      (my $text = $_->[1]) =~ s/\n/\\n/g;  #show newlines
      print "[$_->[0], $text]\n"
    }
    __DATA__
    Some text
    %{ statement 1 }%
    Some more
    text
    %{ statement 2}%%{ statement 3 }%
    %{multi-line
    statement 4}%text%{ statement 5 }%

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 18 Mar 1998 06:51:31 GMT
From: "Sybase DBA" <greyfld@ix.netcom.com>
Subject: Perl 5.004 install problem
Message-Id: <01bd523a$674ca920$b3471ecc@greyfld.ix.netcom.com>

I am trying to install Perl in AIX 415 machine and get an error when trying
to run the make command.

The configure runs fine and most of the modules comple using the native IBM
cc compiler.  

        rm -f libperl.a
        ar rcu libperl.a perl.o  gv.o toke.o perly.o op.o regcomp.o dump.o
util.
o mg.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o
doio.
o regexec.o taint.o deb.o universal.o globals.o perlio.o
        cc  -L/usr/local/lib -o miniperl miniperlmain.o libperl.a -ldbm
-lld -lm
 -lc -lbsd -lPW
        ./miniperl configpm tmp
        sh mv-if-diff tmp lib/Config.pm
        ./miniperl -Ilib pod/pod2html.PL
Extracting pod2html (with variable substitutions)
        ./miniperl -Ilib pod/pod2latex.PL
Extracting pod2latex (with variable substitutions)
        ./miniperl -Ilib pod/pod2man.PL
Extracting pod2man (with variable substitutions)
        ./miniperl -Ilib pod/pod2text.PL
Extracting pod2text (with variable substitutions)
        AutoSplitting perl library
        ./miniperl minimod.pl > tmp && mv tmp lib/ExtUtils/Miniperl.pm
        `sh  cflags libperl.a perlmain.o`  perlmain.c
          CCCMD =  cc -DPERL_CORE -c -qmaxmem=8192 -D_ALL_SOURCE
-D_ANSI_C_SOURC
E -D_POSIX_SOURCE -O
        Making DynaLoader (static)
Makefile out-of-date with respect to ../../lib/Config.pm ../../config.h    
                                                        
Cleaning current config before rebuilding Makefile...
        make -f Makefile.old clean > /dev/null 2>&1 || /bin/sh -c true
        ../../miniperl "-I../../lib" "-I../../lib" Makefile.PL
"INSTALLDIRS=perl
" "LIBPERL_A=libperl.a"
Writing Makefile for DynaLoader
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command.  <==
        false
make: 1254-004 The error code from the last command is 1.


Stop.
make config failed, continuing anyway...
The Unsupported function umask function is unimplemented at
 ..../../lib/ExtUtils/I
nstall.pm line 247.
make: 1254-004 The error code from the last command is 2.


Stop.
make: 1254-004 The error code from the last command is 2.


Stop.




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

Date: 18 Mar 1998 05:45:06 GMT
From: ricci@cs.ust.hk (Ieong Sze Chung Ricci)
Subject: Perl on IIS
Message-Id: <6enn12$s4f@ustsu10.ust.hk>


Hello All,

	I would like to place the Perl Script CGI code to the Microsoft
IIS 3.0. I have already created the cgi-bin directory and installed the
Perl 5.003 interpreter. In fact, I have also tested the Perl script
directly on the command line. However, I can't have the Perl script run.

	Is there any one out there have tackel that problem? Can any one
tell me the clue to this problem?

	I have already associate the .pl file to Perlscript and run the
Perl script with the Perl.exe. Everything should be OK! But when I call
the script by Action=http://domain/cgi-bin/test.pl, the web pages keep
connecting for a long time and then time out. if I use the CGI2shell.exe
(converted to test.exe), then the program gives a message:

CGI Error

The specified CGI application misbehaved by not returning a complete set
of HTTP headers. The headers it did return are:

	I would like to use Perl Script on MS IIS. Can any one please tell
me possible solution.

	Thanks.

Ricci Ieong


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

Date: Wed, 18 Mar 1998 00:57:30 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: removing everything between < and >
Message-Id: <350F624E.2B8F5CDD@coos.dartmouth.edu>

Eric Wong wrote:
> 
> : $line = "This is <strong>strong</strong> and this is <b>bold</b> and
> : this is plain text.";
> : $line =~ s/<.+>//g;
> 
> What you want is
>   $line =~ s/<.+?>//g;
> 
> Look for the term "greedy" in the perlre manpage.

No, what he really wants is
$line =~ s/<[^>]+>//g;
which is much more efficient.

Don't use non-greedy quantifiers when you don't have to.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Wed, 18 Mar 1998 05:55:41 GMT
From: jbritain@home.com (Jim Britain)
Subject: Re: VERY URGENT !!!
Message-Id: <350f60dc.5240479@news>

On Wed, 18 Mar 1998 01:14:22 -0000, "PORTUGAL SYSTEMS"
<webmaster@portugalsystems.pt> wrote:

>I need to calculate two field on real time, inside a Perl Script. This two
>fields are inserted through a Form.
>How can I do that ? Adding variable 1 to variable 2 and give a result x ?

$resultx = form{'variable1'} + form{'variable2'};

Or am I missing something?


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

Date: Wed, 18 Mar 1998 06:46:49 GMT
From: James Ludlow <jdludlow@millcomm.com>
Subject: Re: VERY URGENT !!!
Message-Id: <350F1A78.509C6240@millcomm.com>

PORTUGAL SYSTEMS wrote:
> 
> Hello all:
> I need to calculate two field on real time, inside a Perl Script. This two
> fields are inserted through a Form.
> How can I do that ? Adding variable 1 to variable 2 and give a result x ?

I can't decide if this is for real, or if it's a troll.  What exactly is your
question?  Do you not understand how to use forms?  Do you not understand the
mathematical operators used in perl?  I can understand that if it's truly
"very urgent" then you probably sent off this post in a hurry.  But, you'll
get much better help if you just take the time to actually ask a question. 
Also, make sure it really is a Perl question before you ask it here.

Thank you, try again.

--
James Ludlow (jdludlow@millcomm.com)


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

Date: Wed, 18 Mar 1998 01:35:50 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: indhiraa@hotmail.com
Subject: Re: Why this one doesn't work ?
Message-Id: <350F6B4C.9B41213C@coos.dartmouth.edu>

[posted and mailed]

indhiraa@hotmail.com wrote:
> 
> I have a PERL program whose first 3 lines are like this:
> 
> #!/bin/sh
> # this line will be comment for PERL \
> exec perl "$0" $@"
> 
> print "hello..\n";
> 
> My intention is to avoid hard-coding the path to the Perl interpreter.
> but this script continuously execs and never goes beyond that.
> 
> Am I missing anything here.

Yes, the documentation apparently.  ;-)

>From man perlrun:

     If the #! line does not contain the word "perl", the program named after
     the #! is executed instead of the Perl interpreter.  This is slightly
     bizarre, but it helps people on machines that don't do #!, because they
     can tell a program that their SHELL is /usr/bin/perl, and Perl will then
     dispatch the program to the correct interpreter for them.

So, sh executes your script with perl, which looks at the #! line and executes
your script with sh, which executes your script with perl, which...


Programming Perl, 2nd Ed, page 12, suggests this solution:
(also found in perlrun in slightly different form)

#!/bin/sh -- # perl, to stop looping
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
  if 0;

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 18 Mar 1998 06:16:34 GMT
From: nascheme@acs.ucalgary.ca (Neil Schemenauer)
Subject: Re: Why this one doesn't work ?
Message-Id: <6enos2$p9c@ds2.acs.ucalgary.ca>

On 17 Mar 1998 19:10:37 GMT, Tom Grydeland <Tom.Grydeland@phys.uit.no> wrote:
>On 17 Mar 1998 13:40:15 GMT,
>Hunter Johnson <jhunterj@lexis-nexis.com> wrote:
>
>> Try starting with
>> #!perl
>> if it's important to avoid hard-coding the path.
>
>That won't work.

How about:

#!/usr/bin/env perl


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 2123
**************************************

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