[6513] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 138 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 18 12:17:24 1997

Date: Tue, 18 Mar 97 09:00:19 -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, 18 Mar 1997     Volume: 8 Number: 138

Today's topics:
     Re: [Q] for loop - making multiple arrays <merlyn@stonehenge.com>
     Access to "my" variables from the debugger <mark.andrew@fr.bosch.de>
     Re: AntiSPAM is as bad as SPAM (was Can you help me wit (Bennett Todd)
     Re: AntiSPAM is as bad as SPAM (was Can you help me wit (I R A Aggie)
     Assignment of string not working (Philip Ives)
     Re: Basic $ENV questions (Mats Forssblad)
     BUG? Improper variable interpolation in patterns? (Marc Rouleau)
     Re: Can 5.01 handle 4.0.1.8 scripts? (John Goerzen)
     Re: Elegant way to strip spaces off the ^ and $ of a va (Tony Bass)
     HELP? Hypertext Compiler <rvpec@wmin.ac.uk>
     Re: HELP? Hypertext Compiler (Bob Wilkinson)
     How to read a Fixed Format File? (Baruch Promislow)
     Re: Multiple substitutions <merlyn@stonehenge.com>
     Re: Newbie Perl question (Tad McClellan)
     Re: Newbie Perl question <mohan@sapna.india.hp.com>
     Re: Problems with map and its side effects (Michael Constant)
     regex found but forgotten <mstearns@darkwing.uoregon.edu>
     Regular Expressions Problem (maurice walshe)
     Split (Fapso Marek)
     Re: Split (Brian Jepson)
     Re: Split (Tad McClellan)
     Re: Split (Bob Wilkinson)
     Re: Split <rootbeer@teleport.com>
     Re: Why does string comparison use signed chars? (M.J.T. Guy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 18 Mar 1997 06:59:57 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Opera Ghost <OperaGhost@NetTown.com>
Subject: Re: [Q] for loop - making multiple arrays
Message-Id: <8csp1t2tcy.fsf@gadget.cscaper.com>

>>>>> "Opera" == Opera Ghost <OperaGhost@NetTown.com> writes:

Opera> uh...i guess ull need perl5 too...

Like there's any other version of Perl out?

The development team recently moved the 4.0 sources from CPAN/src/4.0
to CPAN/src/unsupported/4.0.  That should be a clue to y'all out
there.  (I think tchrist was voting to move it to
CPAN/src/flea-bitten-dead-carcasses/, but that wouldn't have been
mirrorable on 8.3 filesystems. :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 532 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 18 Mar 1997 17:44:42 +0100
From: Mark Andrew <mark.andrew@fr.bosch.de>
Subject: Access to "my" variables from the debugger
Message-Id: <332EC67A.F39@fr.bosch.de>

How do I use the X command to print a "my" variable
in the perl debugger ? 

TIA 


Mark Andrew


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

Date: Tue, 18 Mar 1997 13:15:51 GMT
From: bet@nospam.interactive.net (Bennett Todd)
Subject: Re: AntiSPAM is as bad as SPAM (was Can you help me with this script?)
Message-Id: <slrn5it5c6.517.bet@onyx.interactive.net>

On Mon, 17 Mar 1997 12:34:27 -0500, I R A Aggie <fl_aggie@hotmail.com> wrote:
>This netscape we're talking about...
>
>They brought us such gems as [in no particular order]:
>[...]

And yet, despite all this, they have made the greatest single contribution to
the internet I've seen in _Years_!

In one fell swoop, they've gathered up all the clueless morons, and _Labelled_
their postings!

All you have to do is add:

	[*]
	Score:: -9999
		X-Mailer: Mozilla

to your .slrn-scores file, and you will jump into a time warp, taking you back
to c. 1986, in terms of quality of postings --- and it's getting better over
time, as Netscape continues to suck the inept into it's nicely-marked toilet.

I'm tempted to send 'em a donation, just out of pure gratitude.

-Bennett


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

Date: Tue, 18 Mar 1997 09:32:15 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: AntiSPAM is as bad as SPAM (was Can you help me with this script?)
Message-Id: <fl_aggie-ya02408000R1803970932160001@news.fsu.edu>

In article <slrn5it5c6.517.bet@onyx.interactive.net>,
bet@nospam.interactive.net (Bennett Todd) wrote:

+ On Mon, 17 Mar 1997 12:34:27 -0500, I R A Aggie <fl_aggie@hotmail.com> wrote:
+ >This netscape we're talking about...

+ And yet, despite all this, they have made the greatest single contribution to
+ the internet I've seen in _Years_!

+ In one fell swoop, they've gathered up all the clueless morons, and _Labelled_
+ their postings!

Ok, a point in their favor.

James - unintentional on their part, as always...

-- 
Consulting Minster for Consultants, DNRC

To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: 18 Mar 1997 15:28:58 GMT
From: st94zm5g@dunx1.ocs.drexel.edu (Philip Ives)
Subject: Assignment of string not working
Message-Id: <5gmcbq$g9b@noc2.drexel.edu>

Followup-To: 
Distribution: 
Organization: Drexel University, Philadelphia
Keywords: 
Cc: 

In my script I am assigning a string variable to the $to variable to sendmail.
It does not seem to be working and I cannot figure out why.  The variable is 
coming from a form that I am splitting the name value pairs frmo
the assignment is:the assignment is:the assignment is:the assignment is:the assignment is:the assignment is:
$to= "$contents('outAddress')";
please reply to st94zm5g@post.drexel.edu

Thanks 




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

Date: Tue, 18 Mar 1997 13:28:51 GMT
From: froz@algonet.se (Mats Forssblad)
Subject: Re: Basic $ENV questions
Message-Id: <5gm5gu$16i@epimetheus.algonet.se>

"Peter W. Roach" <proach@cais.com> wrote:

>Tom,
>Re: "There aren't any more.  I promise.." I am not so sure. I am running
>PERL on Win95 to run CGI scripts for Microsoft Personal Web Server. When I
>try this routine in a CGI script called via the server, I only get the
>environment variables already referenced by the program. If I don't
>reference $ENV{'HTTP_USER_AGENT'}, for instance, then that variable is not
>listed by the "foreach" routine. Strange! Any ideas?
It does maybe not look cute, unsplit and all, but one can operate
directly with %ENV and print it, save to a file, whatever. Also, with
a shell, the SET command can be used.



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

Date: 18 Mar 1997 08:57:36 -0600
From: mer@world.evansville.net (Marc Rouleau)
Subject: BUG? Improper variable interpolation in patterns?
Message-Id: <5gmah0$mdn@world.evansville.net>

$_ = '$x'; $a = '$x'; $b = '\$x';
print "\$a matched\n" if /$a/;
print "\$b matched\n" if /$b/;

My output from this fragment is

  $b matched

I guessed that perl is interpolating $a to be the string '$x' and then
incorrectly re-interpolating $x, but that doesn't seem to be the case.
If I try

$_ = 'abc'; $x = abc; $a = '$x'; $b = '\$x';
print "\$a matched\n" if /$a/;
print "\$b matched\n" if /$b/;

I get no output.  Is this pilot error or a bug?  If the former, would
some kind soul please enlighten me?

perl -v output follows:

This is perl, version 5.003 with EMBED
        built under solaris at Oct 29 1996 15:22:08
        + suidperl security patch

    -- Marc Rouleau

VP and Director of Engineering     Voice: (812) 479-1700   Fax: (812) 479-3439
World Connection Services, LLC              http://www.evansville.net


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

Date: 16 Mar 1997 01:17:08 GMT
From: jgoerzen@complete.org (John Goerzen)
Subject: Re: Can 5.01 handle 4.0.1.8 scripts?
Message-Id: <slrn5imigk.6d7.jgoerzen@complete.org>

There were some changes in Perl 5 that means that Perl 4 code won't
necessarily parse correctly.  There is a list of these items in the "Camel
book" (Programming Perl, 2nd ed., by Larry Wall, Tom Christiansen, and
Randal Schwarz)  [ I hope I spelled all those names correctly, I am typing
from memory... ]

John

On 14 Mar 1997 23:10:01 GMT, Marshall Pierce <piercem@col.hp.com> wrote:
>I thought 5.01 could correctly deal with 4.0 syntax?  If this is not the
>case, is there a comprehensive list somewhere which identifies those
>things which would have to be changed.  Even better, is there a conversion
>tool?
>
>Thanks
>
>
>--
>=-=-=-=-= Marshall V Pierce              World Wide User Support Program
> /_ __    marshall_pierce@hp.com                Technology Team                 
>/ //_/    (719) 590-3461
>  /       http://hpweb.cs.itc.hp.com/solutions/wwsms.html


-- 
John Goerzen          | Running Debian GNU/Linux (www.debian.org)
Custom Programming    | 
jgoerzen@complete.org | 


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

Date: 18 Mar 1997 09:28:32 -0000
From: aeb@calf.saltfarm.bt.co.uk (Tony Bass)
Subject: Re: Elegant way to strip spaces off the ^ and $ of a variable containing a sentence.
Message-Id: <5gln80$t7r@calf.saltfarm.bt.co.uk>

>From article <8csp1xydui.fsf@gadget.cscaper.com>, by Randal Schwartz <merlyn@stonehenge.com>:
>>>>>> "Chris" == Chris Russo <crusso@alink.net> writes:

> Chris> I mean, these are the same guys who included:

> Chris> select((select(STDERR), $| = 1)[0])

> Chris> in the manual that *they* wrote.  :) Yes, I know that there's a
> Chris> comment of its being "bizarre and obscure", but by including it
> Chris> and from the fact that I've never seen its usage disparaged
> Chris> here, it seems to be "bizarre and obscure but accepted".
> Chris> Meanwhile, the map thing isn't bizarre, but it's a little
> Chris> obscure and *not* accepted.

> I wrote that, and I have repented since that time.  I'm no longer
> "randal the clever hack author".  I'm trying to stay a little more
> mainstream these days.  map and grep in a void context... Ick. :-)

The foreach rendering may be awkward if the input list is generated by
complex calculations.  An actual example

    grep { vec($result, $outp++, 32) = $_ if (not $seen[$_]++); }
     map { $_ ? ($_ + $r) : (@edge); } @dedge;

would be tolerable in foreach form but indicates what might happen if
the mapping became more complicated (eg a composition of two maps).
(And also, conceptually this particular example *is* list output - only
the representation has changed!)

I accept that grep in void context is likely to have a little overhead
that foreach does not, and that void-grep is probably best avoided when
giving simple examples of ways of doing things.

I agree with totally avoiding map in void context, since the
documentation (at 5.001 man pages and second camel) does not define it
in scalar context.



> On the other hand, many people have written me to tell me that the
> Schwartzian Transform is second only to sliced bread.  Cool.

Yes indeed.  Thank you.

    Tony Bass

-- 
# Tony Bass                                     Tel: (01473) 645305
# MLB 3/19, BT Laboratories                     e-mail: aeb@saltfarm.bt.co.uk
# Martlesham Heath, Ipswich, Suffolk, IP5 7RE   DO NOT e-mail to From: line
#                                               Opinions are my own


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

Date: Tue, 18 Mar 1997 13:25:00 +0000
From: Orla Harrell <rvpec@wmin.ac.uk>
Subject: HELP? Hypertext Compiler
Message-Id: <332E97AC.420A@wmin.ac.uk>

HELP??

I am writing a Hypertext Compiler in the C programming language which
checks the syntax of HTML, displays the error message when wrong.
 
Also I want to do a conversion of text to hypertext to in C too.
I have seen it done in Perl, but I need it in C.

If anyone can help, please email me, need help fast, would be ever so
greatful.


Do you know where I can get information, or anything that will help.
 
Thanks....
 
 
-----------------------------------------------------------------------
Orla Harrell
BSc Artificial Intelligence
University of Westminster
email: rvpec@wmin.ac.uk
http://www.wmin.ac.uk/~rvpec


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

Date: Tue, 18 Mar 1997 15:00:09 -0500
From: b.wilkinson@NOSPAM.pindar.co.uk (Bob Wilkinson)
Subject: Re: HELP? Hypertext Compiler
Message-Id: <b.wilkinson-1803971500090001@ip57-york.pindar.co.uk>

In article <332E97AC.420A@wmin.ac.uk>, Orla Harrell <rvpec@wmin.ac.uk> wrote:

> HELP??
> 
> I am writing a Hypertext Compiler in the C programming language which
> checks the syntax of HTML, displays the error message when wrong.
>  
> Also I want to do a conversion of text to hypertext to in C too.
> I have seen it done in Perl, but I need it in C.
> 
> If anyone can help, please email me, need help fast, would be ever so
> greatful.
> 
> 
> Do you know where I can get information, or anything that will help.
>  
> Thanks....
>  
>  
> -----------------------------------------------------------------------
> Orla Harrell
> BSc Artificial Intelligence
> University of Westminster
> email: rvpec@wmin.ac.uk
> http://www.wmin.ac.uk/~rvpec

There are many programs already written which have this functionality.
I often use "nsgmls" (before that "sgmls") written by James Clark which
are full SGML parsers - HTML is specific-SGML, the specification being
the HTML DTD. These are available from www.jclark.com.

There are also many specific HTML "lint-type" checkers available.

Bob

-- 
All is flux, nothing is still; nothing endures but change
- Heraclitus


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

Date: Mon, 17 Mar 1997 08:42:55 GMT
From: baruch@macom.co.il (Baruch Promislow)
Subject: How to read a Fixed Format File?
Message-Id: <5gj04r$rs4$1@news.NetVision.net.il>

Hi!
Is there a way to define a FORMAT for inputing from fixed formatted files, 
similar to the output formats?

I have done all kind of experiments using formats as if for outputting, 
reading a file, but this does not work.


Baruch Promislow
Macom Networking Ltd.
http://www.macom.co.il


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

Date: 18 Mar 1997 06:56:28 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Multiple substitutions
Message-Id: <8cvi6p2tir.fsf@gadget.cscaper.com>

>>>>> "Eric" == Eric Bohlman <ebohlman@netcom.com> writes:

Eric> What has proved profitable to me is to read the posts on this group, 
Eric> especially those that include source code, and look up every constuct 
Eric> that I don't understand right off the bat.  I have 23+ years of 
Eric> programming experience and I still find such techniques helpful.

Exactly.  I've been programming for (35-9=) 24 years myself, and I
find the best way to learn a new language is to *read* every example
snippet I can find, with a reference book close by.  Eventually, the
*rhythm* of the language starts pounding in my head... and my fluency
is close at hand.  That's how I learned Perl, and now I'm one of the
drummers. :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 532 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 18 Mar 1997 07:12:16 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Newbie Perl question
Message-Id: <gb4mg5.dj.ln@localhost>

Unknown (zgeist@ee.net) wrote:
: Unknown (zgeist@ee.net) wrote:


: * my stuff snipped *

: Umm, sorry people.  My netiquette took a leave of absence.

I saw no breach of netiquette in your post, other than no
subject in your Subject:

You did do a rather poor job of describing what it is you wanted though.
That's not bad netiquette, just a waste of time ('cause we might
answer the wrong question)


: Am I posting this in the right NG or should it be in c.l.p ?

There is no comp.lang.perl !

(If you see one on your system, you should contact your system
 administrator. It is a defunct, discontinued newsgroup )

So, it should _not_ go there...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 18 Mar 1997 19:23:47 +0500
From: Mohan Das <mohan@sapna.india.hp.com>
Subject: Re: Newbie Perl question
Message-Id: <t53zpw16zyk.fsf@sapna.india.hp.com>

zgeist@ee.net (Unknown) writes:

> Greetings all -
> 
> I am trying to run an SQL script via my Perl script but it does not
> seem to be working.  I started out using the MAIL example in the Learning 
> Perl book (pg 23) using "open" and "print", but that is not working.
> I have something along the lines of
> 
> open (ORASTUFF,"|sqlplus username/password ");
> print ORASTUFF "\@test.sql\n";
> close (ORASTUFF);
>
> 
> I did get it to work by using the following:
> 
> $dummy = `sqlplus username/password < test.sql `;
> print "Dummy is $dummy";
> 
> Yeah, I know this is horrible,  but I cannot get the filehandle to work
> properly above.

There is nothing wrong with the filehandle, but the problem is in what 
you are writing to that filehandle. The second version seems to suggest
the sqlplus command expects the *contents* of the file "test.sql" from 
STDIN. But in your first version, you are just giving it the string 
"@test.sql".

Try this:

open (ORASTUFF,"|sqlplus username/password ");
open (SQL, "<test.sql") or die "Can't open test.sql: $!\n";
@sql = <SQL>;
close (SQL);
print ORASTUFF "@sql";
close (ORASTUFF);

hth,
mohan

> If you can point me to a more detailed part of either volume of 
> "Programming Perl" or "Learning PERl" that would be great.
> 
> We are running 5.003 on a Perl Digital Unix box.

-- 


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

Date: 18 Mar 1997 04:13:09 -0800
From: mconst@soda.CSUA.Berkeley.EDU (Michael Constant)
Subject: Re: Problems with map and its side effects
Message-Id: <5gm0sl$ehr@soda.CSUA.Berkeley.EDU>

Mik Firestone <mfiresto@mindspring.com> wrote:
>    @vhost = map { s/vh=//; $_ } (grep( /vh=/, @ARGV ));
>
>I expected it to work like this: the grep will create a temporary array
>consisting of ( vh=foo,vh=bar,vh=biteme ).  The map statement with then
>take this temp array, strip the 'vh=' and end up with ( foo,bar,biteme ).
>I did not expect @ARGV to get hosed.  I have copied @ARGV to another list,
>and used that in the map statement.  @ARGV remained untouched, but the same
>thing happened to the other list.

Both map and grep locally make $_ an alias[*] for the appropriate
list element.  If you modify $_, you will be modifying that list.
This you probably already knew.

What you might not have known is that grep returns a list of those
aliases, instead of making a copy of the list.  If you modify the
list returned by grep, you will still be modifying the original list.
The most recent version of perlfunc(1) mentions this, under grep:

    Similarly, grep returns aliases into the original list, much like
    the way that the section on Foreach Loops's index variable aliases
    the list elements.  That is, modifying an element of a list returned
    by grep actually modifies the element in the original list.

If you don't want to modify your original list, there are lots of
ways to copy it; the simplest is to assign the output of grep to a
temporary list.  Here are a few other ways to copy a list, without
using a temporary variable:

    @{[ @list ]}
    map $_, @list
    thaw freeze @list

I mention the last one because it's useful not only for lists but
for more complex data structures too -- it makes a deep copy of an
arbitrary data structure.  See the FreezeThaw module for details.
-- 
        Michael Constant (mconst@soda.csua.berkeley.edu)

[*]  The perl manpages sometimes refer to these as "references";
I don't like that usage, because they aren't references that you
dereference in the normal way.  They're more like magic references
that get dereferenced automatically.  In fact, they're just new
names for old objects -- the manpages sometimes call them "aliases",
and I think this is a good term.


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

Date: Tue, 18 Mar 1997 07:49:19 -0800
From: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: regex found but forgotten
Message-Id: <332EB97F.5A544CE7@darkwing.uoregon.edu>

I am working on a Perl script that converts Framemaker MIF -> HTML.

I have this line, which pulls out a hidden text block in my Frame
document for the HTML title.

The substitution DOES get made (I can open the document and see that
<PgfTag Hidden> has been removed, but the variable $title_placeholder
does not get set to $1. I have put in the print line for a test, and all
that is getting printed is a blank line. I believe it should print what
it found in the parentheses (.*?) in my original regex.

###Make the title
if ($text=~s!\s+<PgfTag\s`Hidden\n+(.*?)\n!\1\n!gs) {
$title_placeholder=$1;
}
print "$title_placeholder\n";



Can anyone see what I am doing wrong here?

Thanks,
Michael Stearns
University of Oregon


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

Date: Tue, 18 Mar 97 15:24:10 GMT
From: walshemj@boat.bt.com (maurice walshe)
Subject: Regular Expressions Problem
Message-Id: <5gmc4j$i1p@pheidippides.axion.bt.co.uk>

Hi all

I have a  problem that I have been banging my head against for several days now

I want to scan a directory tree and for certain directories I want to produce 
a list of its directories (it's to automate a websever directory program)

so I want a regular expression that matches string/any_valid_directory/ but 
not any further down for example hear is some test code illustrating this 
$good_target should match and $badtarget should not.

#!/usr/local/bin/perl
#
$search = "/www/foo/Products/;
$good_target = "/www/foo/Products/Wombats/";
$bad_target "/www/foo/Products/Wombats/Leamur_conspiracy/";

if ($search =~ /$target?=(\/+[a-z*A-Z*]+\//)) {
 Print " Matched \n";
}

Any help gratefully received as I have exausted my understanding of regexps
and my other perl using colleagues are stumped as well.



Rgds Maurice Walshe


The full code including the directory recursion is below I have hiden some 
details of the server I am indexing hence the xxxxxx in the URl's

---------
#!/usr/local/bin/perl
#
require "/www/httpd/cgi-bin/showcase/www_showcase.pl";
require "../../lib/project.ph";
require "stat.pl";
#
# --- scan the subdirectories to build a list of Directories index.html and
#     .indexme files
#
chdir 'xxxxxx/pages/documents/Products';
%filelist = ("dummy",1);   
&dodir('xxxxxx/pages/documents/Products');
delete( $filelist{"dummy"} );
#
# --- remove any entries in the main array that don't have a matching
#     indexme entry

#
# --- print 
#
&print_html_preamble;

printf( "<HTML>\n
<HEAD>\n
<TITLE>Directory</TITLE>\n
</HEAD>\n
<BODY BGCOLOR=#ffffff>\n
<H1>GMS Directory</H1>\n
<HR>\n
<PRE>\n
Test this just dumps the links required to HTML\n <P>");

#
# --- scan through the array of all directories extracting and deleteing
#     the .indexme entries
#
print ".indexme Entries\n<HR>";
while ( ( $holder, $record) = each (%filelist) ) {
  if ($record =~ /.indexme/) {
     print "$holder/$record \n";
     %scanlist =($holder,FALSE);
  }
}
sort(%filelist);
print " Subdirs of .indexme entries \n<HR>";
while ( ( $dir, $flag) = each (%scanlist) ) {
   $dir = $dir."\/";
   while ( ( $holder, $record) = each (%filelist) ) {
     $holder = $holder ."\/";
     print "$holder\n$dir\n";
     if ($dir =~ /$holder\/+[a-zA-Z]*+\//) {
        print "Scaning $holder\n";
     }
   }
}
print "</PRE>\n<HR>\n";

&print_html_trailer;

sub dodir {
    local ($dir,$nlink) = @_;
    local ($dev,$ino,$mode,$subcount);
    ($dev,$ino,$mode,$nlink) = stat('.') unless $nlink;

    opendir(DIR,'.') || 
       die "Can't Open $dir";
    local(@filenames) = readdir(DIR);
    closedir(DIR);

    if ($nlink == 2 ) {                  # No Subdirectories
       for (@filenames) {
           
           next if $_ eq '.';
           next if $_ eq '..';
           if ( -d $_ ) {
#             print "$dir/$_\n";
              $filelist{$dir} = $_;
           }
           elsif (  $_ =~/index.html/ or $_ =~ /.indexme/  and $_ !~ /\%/) {
#             print "$dir/$_\n";
              $filelist{$dir} = $_;
           }
       }
    }
    else {                               # Has subdirectories
       $subcount = $nlink - 2 ;
        for (@filenames) {
           next if $_ eq '.';
           next if $_ eq '..';
           $name = "$dir/$_";
           if ( -d $_ ) {
 #             print "$dir/$_\n";          
               $filelist{$dir} = $_;
           }
           elsif ( $_ =~/index.html/ or $_ =~ /.indexme/ and $_ !~ /\%/) {
#             print "$dir/$_\n";
              $filelist{$dir} = $_;
           }
           next if $subcount == 0;
 
           ($dev,$ino,$mode,$nlink) = lstat($_);
           next unless -d _ ;

           chdir $_ || 
             die "Can't Change to $name";
           &dodir($name,$nlink);
           chdir '..';
          --$subcount;
        }
     }
}
------------------------------------------------------------------------------
|Maurice Walshe               You'll Never Get to heaven with an Ak47,       | 
|                             But a ZSU-30's good for low flying Cherubim    |
|Software Engineer                                                           |
|mjwalshe@boat.bt.com         Phone= + 44 1422 296500                        |
|                This post is not an opinion of BT plc                       |
|-----------------------------------------------------------------------------


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

Date: 18 Mar 1997 11:56:47 GMT
From: fapsom@hron.fei.tuke.sk (Fapso Marek)
Subject: Split
Message-Id: <5glvtv$f4d$1@ccnews.ke.sanet.sk>


Hi all!
I have a program:

$tmp="a|||b|||";
@li=split('\|',$tmp);

	This program split string into array with size only 4.  Why?
						Marek !

--
fapsom@hron.fei.tuke.sk


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

Date: 18 Mar 1997 13:52:59 GMT
From: bjepson@bjepson.ids.net (Brian Jepson)
Subject: Re: Split
Message-Id: <slrn5islac.98.bjepson@bjepson.ids.net>

In article <5glvtv$f4d$1@ccnews.ke.sanet.sk>, Fapso Marek wrote:
>
>Hi all!
>I have a program:
>
>$tmp="a|||b|||";
>@li=split('\|',$tmp);
>
>	This program split string into array with size only 4.  Why?
>						Marek !
>

This happens because split() stops doing its thing when it runs
out of stuff. From perlfunc(1):

  split /PATTERN/, EXPR, LIMIT

  ...

  If LIMIT is unspecified, trailing null fields are stripped (which
  potential users of pop() would do well to remember). If LIMIT is
  negative, it is treated as if an arbitrarily large LIMIT had been
  specified.

So, try something like:

  @li=split(/\|/, $tmp, -1);

And you should get what you want.

Hope this helps,

-- 
Brian Jepson * (bjepson@ids.net)  *  http://www.ids.net/~bjepson
  Int(ra|er)net Database Developer, Author, Crypto-Fluxologist
Non-Prophet Arts Technology Flux:      http://www.ids.net/~as220
WWW/Database/NT,Java/Database: http://www.ids.net/~bjepson/books



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

Date: Tue, 18 Mar 1997 08:01:18 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Split
Message-Id: <e77mg5.4r.ln@localhost>

Fapso Marek (fapsom@hron.fei.tuke.sk) wrote:

: I have a program:

: $tmp="a|||b|||";
: @li=split('\|',$tmp);

: 	This program split string into array with size only 4.  Why?


Because that's how split works.

As I'm sure you are a good net citizen (who checks the available free
documentation, that is included with the perl distribution), and not
one of those moochers who just want the newsgroup to read the docs
for them, I guess you didn't understand this description of split()
given in the perlfunc man page?


-----------------
=item split /PATTERN/,EXPR,LIMIT

=item split /PATTERN/,EXPR

=item split /PATTERN/

=item split

Splits a string into an array of strings, and returns it.

If not in a list context, returns the number of fields found and splits into
the @_ array.  (In a list context, you can force the split into @_ by
using C<??> as the pattern delimiters, but it still returns the array
value.)  The use of implicit split to @_ is deprecated, however.

If EXPR is omitted, splits the $_ string.  If PATTERN is also omitted,
splits on whitespace (after skipping any leading whitespace).  Anything
matching PATTERN is taken to be a delimiter separating the fields.  (Note
that the delimiter may be longer than one character.)  If LIMIT is
specified and is not negative, splits into no more than that many fields
(though it may split into fewer).  If LIMIT is unspecified, trailing null
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fields are stripped (which potential users of pop() would do well to
^^^^^^^^^^^^^^^^^^^
remember).  If LIMIT is negative, it is treated as if an arbitrarily large
LIMIT had been specified.
-----------------


Looks like you have six fields. When split() strips the two trailing
null fields you end up with how much?


perl -e 'print 6-2, "\n"'



Golly, those man pages sure do have a lot of good stuff in them...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 18 Mar 1997 15:02:22 -0500
From: b.wilkinson@NOSPAM.pindar.co.uk (Bob Wilkinson)
Subject: Re: Split
Message-Id: <b.wilkinson-1803971502220001@ip57-york.pindar.co.uk>

In article <5glvtv$f4d$1@ccnews.ke.sanet.sk>, fapsom@hron.fei.tuke.sk
(Fapso Marek) wrote:

> Hi all!
> I have a program:
> 
> $tmp="a|||b|||";
> @li=split('\|',$tmp);
> 
>         This program split string into array with size only 4.  Why?
>                                                 Marek !
> 
> --
> fapsom@hron.fei.tuke.sk

Split expects a /PATTERN/ as the first parameter, rather than a string.

Try @li=split(/\|/,$tmp); instead.

Bob

-- 
All is flux, nothing is still; nothing endures but change
- Heraclitus


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

Date: Tue, 18 Mar 1997 08:42:21 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Fapso Marek <fapsom@hron.fei.tuke.sk>
Subject: Re: Split
Message-Id: <Pine.GSO.3.96.970318083949.19440D-100000@kelly.teleport.com>

On 18 Mar 1997, Fapso Marek wrote:

> $tmp="a|||b|||";
> @li=split('\|',$tmp);
> 
> 	This program split string into array with size only 4.  Why?

Because it does what the docs say it does, perhaps? :-)  See perlfunc(1),
and look for the phrase "If LIMIT is unspecified, trailing null fields are
stripped". Hope this helps! 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 18 Mar 1997 12:11:30 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Why does string comparison use signed chars?
Message-Id: <5gm0pi$p14@lyra.csx.cam.ac.uk>

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>[A complimentary Cc of this posting was sent to Vladimir Alexiev 
><vladimir@cs.ualberta.ca>],
>who wrote in article <omzpw317g6.fsf@tees.cs.ualberta.ca>:
>> Is there any particular reason string comparison (cmp, lt, le, etc) uses
>> signed chars? 
>
>I think it is a bug/feature of the system call perl uses. I _think_
>newer perls have a test in Configure which will substitute a
>reasonable function if platform memcmp (sp?) is broken.

That's right.   I reported this problem under SunOS 4, and it was mended
in (I think) perl5.003_17.   So getting the beta is a good idea.


Mike Guy


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

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

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