[19712] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1907 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 10 18:10:31 2001

Date: Wed, 10 Oct 2001 15:10:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1002751814-v10-i1907@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 10 Oct 2001     Volume: 10 Number: 1907

Today's topics:
        predefined @- and @+ or what happens here? (Christoph Bergmann)
    Re: predefined @- and @+ or what happens here? (Mark Jason Dominus)
    Re: predefined @- and @+ or what happens here? <ilya@martynov.org>
    Re: question about MAP function, please help. <Doug.King@abh.siemens.com>
        Reformat Chain (Houda Araj)
    Re: Reformat Chain <jeff@vpservices.com>
        Regular Expressions <ben@benhaworth.com>
    Re: Regular Expressions <tsee@gmx.net>
    Re: Regular Expressions blah@blah.blah.invalid
    Re: Sort unique Very large file <iltzu@sci.invalid>
        Sorting larg arrays <mostromx32s@x32siname.com>
    Re: Sorting larg arrays <tsee@gmx.net>
    Re: Sorting larg arrays <tsee@gmx.net>
    Re: split into filename and extension (need help before <cpdog@nospam.com>
    Re: split into filename and extension (need help before <iltzu@sci.invalid>
    Re: Stop Transversal of a Directory with Tar and Unzip (BUCK NAKED1)
    Re: Why dosen't this work? nobull@mail.com
    Re: Why dosen't this work? <uri@sysarch.com>
    Re: Why dosen't this work? (Abigail)
        win32::TieRegistry Print problem... <boogiemonster@usa.net>
        zipping files? <jessica.bull@broadwing.com>
    Re: zipping files? <Laocoon@eudoramail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 10 Oct 2001 12:18:47 -0700
From: info@java.seite.net (Christoph Bergmann)
Subject: predefined @- and @+ or what happens here?
Message-Id: <102b94bd.0110101118.251ec030@posting.google.com>

Hi...

Does anybody know why this gives an error:

my($put,%put);
$put=\%put;
$$put{bla}="-";
$$put{bla}[0]="whatever";

It prints out:

Modification of a read-only value attempted at xxxxx.pl line xx.

I know the example looks a bit weird, but thats how I found it: Perl
uses $put{bla} as a symbolic reference with "-" and so it comes to:
$-[0]. It only happens with "-" or "+", so it looks like there are
predefined arrays like @- and @+. But I've never heard of them, do
they exist ?

And it happens only with Perl 5.6.1 - I tried it with Perl 5.5.3 and
it works OK. Is it a bug or something in Perl 5.6.1 ?


Furthermore if I call the following 2 lines with
Apache(1.3.20)/mod_perl(1.26):

print "$_<br>" foreach (@-);
print "<br>";
print "$_<br>" foreach (@+);

they print out

10 10 11
11 11 11

So it looks like there are predefined arrays @- and @+ and they
contain something under mod_perl. Does anybody know what ?

But they contain values only in mod_perl: When I run the lines from
the shell they print nothing (except "<br>") - as expected.


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

Date: Wed, 10 Oct 2001 20:17:09 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: predefined @- and @+ or what happens here?
Message-Id: <3bc4acc4.5b18$1eb@news.op.net>

In article <102b94bd.0110101118.251ec030@posting.google.com>,
Christoph Bergmann <info@java.seite.net> wrote:
>I know the example looks a bit weird, but thats how I found it: Perl
>uses $put{bla} as a symbolic reference with "-" and so it comes to:
>$-[0]. It only happens with "-" or "+", so it looks like there are
>predefined arrays like @- and @+. 

Excellent deduction, Holmes!  You are exactly right.

>But I've never heard of them, do they exist ?

Yes.  All Perl's special variables are described in the 'perlvar'
manual page.  (Do web search for 'perlvar', or consult www.perldoc.com
>if you don't have a copy of 'perlvar'.

Here's what it has to say:

       @-      $-[0] is the offset of the start of the last suc-
	       cessful match.  "$-["n"]" is the offset of the
	       start of the substring matched by n-th subpattern,
	       or undef if the subpattern did not match.

	       Thus after a match against $_, $& coincides with
	       "substr $_, $-[0], $+[0] - $-[0]".  Similarly,
	       "$"n coincides with "substr $_, $-["n"], $+["n"] -
	       $-["n"]" if "$-["n"]" is defined, and $+ coincides
	       with "substr $_, $-[$#-], $+[$#-]".  One can use
	       "$#-" to find the last matched subgroup in the
	       last successful match.  Contrast with "$#+", the
	       number of subgroups in the regular expression.
	       Compare with "@+".

I left out some more information.  The manual also includes several examples.

>And it happens only with Perl 5.6.1 - I tried it with Perl 5.5.3 and
>it works OK. Is it a bug or something in Perl 5.6.1 ?

@- and @+ didn't exist yet in 5.5.3.

>So it looks like there are predefined arrays @- and @+ and they
>contain something under mod_perl. Does anybody know what ?

That looks to me like a weird fluke.


>But they contain values only in mod_perl: When I run the lines from
>the shell they print nothing (except "<br>") - as expected.

Try this:

        "cookies" =~ /(o+)k(.*)/; 
        print "\t", @-, "\n\t", @+, "\n"'

$-[0] and $+[0] are 1 and 7, because the regex matched characters 1-6
of the target string.  (@+ holds the position just after the last
matching character, so that $+[0] - $-[0] is the length of the matched
string 'ookies'.)

$-[1] and $+[1] are 1 and 3, because the /(o+)/ matched characters 1-2 only.

$-[2] and $+[2] are 4 and 7, because the /(.*)/ matched characters 4-6 only.

Hope this helps.
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 11 Oct 2001 00:19:51 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: predefined @- and @+ or what happens here?
Message-Id: <87r8sb9riw.fsf@abra.ru>

>>>>> On 10 Oct 2001 12:18:47 -0700, info@java.seite.net (Christoph Bergmann) said:

CB> Hi...
CB> Does anybody know why this gives an error:

CB> my($put,%put);
CB> $put=\%put;
CB> $$put{bla}="-";
CB> $$put{bla}[0]="whatever";

CB> It prints out:

CB> Modification of a read-only value attempted at xxxxx.pl line xx.

CB> I know the example looks a bit weird, but thats how I found it: Perl
CB> uses $put{bla} as a symbolic reference with "-" and so it comes to:
CB> $-[0]. It only happens with "-" or "+", so it looks like there are
CB> predefined arrays like @- and @+. But I've never heard of them, do
CB> they exist ?

You are right about symbolic reference. About @- and @+ see below.

CB> And it happens only with Perl 5.6.1 - I tried it with Perl 5.5.3 and
CB> it works OK. Is it a bug or something in Perl 5.6.1 ?

Nope. It looks like a bug in your code. Why do you try to assign
string to some variable and later use it as array ref? It seems your
original intention wasn't usage of symbolic reference. Add 'use
strict' to you script and Perl will complain about it even in 5.5.3.

CB> Furthermore if I call the following 2 lines with
CB> Apache(1.3.20)/mod_perl(1.26):

CB> print "$_<br>" foreach (@-);
CB> print "<br>";
CB> print "$_<br>" foreach (@+);

CB> they print out

CB> 10 10 11
CB> 11 11 11

CB> So it looks like there are predefined arrays @- and @+ and they
CB> contain something under mod_perl. Does anybody know what ?

As I already answered you on mod_perl list read 'perldoc perlvar'. @-
and @+ are special Perl variables defined after regexp match
operations. They was introduced in recent versions of Perl (probably
>= 5.6.1 - I'm not sure).

CB> But they contain values only in mod_perl: When I run the lines from
CB> the shell they print nothing (except "<br>") - as expected.

It have noting to do with mod_perl. Probably mod_perl uses regexp
somethere so these variables get initialized.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Wed, 10 Oct 2001 15:54:07 -0400
From: Doug King <Doug.King@abh.siemens.com>
Subject: Re: question about MAP function, please help.
Message-Id: <3BC4A75F.CE5F6CC9@abh.siemens.com>

"Thomas B$B(Btzler" wrote:
> 
> On Sun, 07 Oct 2001, clintp@geeksalad.org (Clinton A. Pierce) wrote:
> >map is used to iterate over one list, returning another list.  Essentially
> >doing a transformation of the first into the second.  The second list can
> >be larger, smaller, related to or have nothing to do with the first list
> >at all.
> 
> One thing to bear  in mind is that $_ is an alias for the elements of
> the source list. If you modify $_, you also modify your input. Doing
> this is usually considered a boo-boo.

I often use map to *intentionally* modify all the elements in an array:

map { s/asdf/lkj/ } @arr;

> 
> If you want to have only some elements from the input list in your
> output, you should probably use grep.
> 
> Just my $0.02,
> --
> use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
> split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
> '"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
> $_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: 10 Oct 2001 14:46:19 -0700
From: Houda.Araj@cogmedia.com (Houda Araj)
Subject: Reformat Chain
Message-Id: <21916d9f.0110101346.4154bfab@posting.google.com>

I used this script to reformat chain.  What Went Wrong?  

Script
#!/usr/bin/perl -w
use strict;
my @words = split /\s+/, <DATA>;
my @notes = split /\s+/, <DATA>;
print join( ' ', map { $_ . "_" . uc( splice @notes,0,1 ) } @words );


Input Chain
cases will be by   means of either the operation of the appropriate 
nns   md/3 be rb/2 vbz/3 in cc     at  nn        in at  jj/2        

Output Chain
cases_NNS will_MD/3 be_BE by_RB/2   means_VBZ/3 of_IN either_CC the_AT
operation_NN of_IN the_AT appropriate_JJ/2

Result
52 [shell.onix.net:/home/houda] : perl reformat.pl
Read on closed filehandle <DATA> at reformat.pl line 3.
Read on closed filehandle <DATA> at reformat.pl line 4.
53 [shell.onix.net:/home/houda] : rm Data.txt
remove Data.txt? y
54 [shell.onix.net:/home/houda] : perl reformat.pl
Read on closed filehandle <DATA> at reformat.pl line 3.
Read on closed filehandle <DATA> at reformat.pl line 4.
55 [shell.onix.net:/home/houda] :      

Thanks

Houda


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

Date: Wed, 10 Oct 2001 14:51:35 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Reformat Chain
Message-Id: <3BC4C2E7.AA36901C@vpservices.com>

Houda Araj wrote:
> 
> ...
>
> my @words = split /\s+/, <DATA>;

This empties the DATA array.

> my @notes = split /\s+/, <DATA>;

This attempts to read from the empty DATA array.

Either put DATA into an actual array and loop through it twice, or do
something like this:

  my $datapos = tell DATA;   # record start of data
  print while(<DATA>);       # print data (or otherwise process it)
  seek DATA,$datapos,0;      # go back to recorded start of data
  print while(<DATA>);       # print data (or otherwise process it)
again
  __DATA__
  this
  is
  a
  test

-- 
Jeff


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

Date: Wed, 10 Oct 2001 21:15:03 +0100
From: "Ben" <ben@benhaworth.com>
Subject: Regular Expressions
Message-Id: <9q2a0h$4il$1@sparkie.st-andrews.ac.uk>

Does any one know how to search a string from say four different letters but
with them in any order?  e.g. I want to look for the letters e,l,t and n in
the Unix words file.  They all need to be in the word but can be in any
order.

Thanks,
Ben.




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

Date: Wed, 10 Oct 2001 23:00:09 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Regular Expressions
Message-Id: <9q2cve$2ul$04$2@news.t-online.com>

"Ben" <ben@benhaworth.com> schrieb im Newsbeitrag
news:9q2a0h$4il$1@sparkie.st-andrews.ac.uk...
> Does any one know how to search a string from say four different letters
but
> with them in any order?  e.g. I want to look for the letters e,l,t and n
in
> the Unix words file.  They all need to be in the word but can be in any
> order.

Please be more concise: Do the just have to be in the word or do they have
to be next to each other like whatevereltnwhatever?

For the former, why not just use 4 regexes and && ?

if ( /e/ && /l/ && /t/ && /n/ ) {}

I wouldn't bet on this to be the best solution, however. I'm not into re's a
lot.

Steffen





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

Date: Wed, 10 Oct 2001 21:08:12 -0000
From: blah@blah.blah.invalid
Subject: Re: Regular Expressions
Message-Id: <ts9e5sb9dh6a65@corp.supernews.com>

Ben <ben@benhaworth.com> wrote:
> Does any one know how to search a string from say four different letters but
> with them in any order?  e.g. I want to look for the letters e,l,t and n in
> the Unix words file.  They all need to be in the word but can be in any
> order.

The simplest solution would be to run through the regex's serially.

    perl -ne 'print if ( m/l/ && m/n/ && m/t/ && m/e/ );' 

I'm just guessing the order of the regex's (trying to order themby
frequency, least frequent letters first).

-- 
Eric Wong
eric+pgp@taedium.com                        http://www.taedium.com/pgp.txt


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

Date: 10 Oct 2001 21:44:43 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Sort unique Very large file
Message-Id: <1002750090.8052@itz.pp.sci.fi>

In article <slrn9s87d1.71l.rgarciasuarez@rafael.kazibao.net>, Rafael Garcia-Suarez wrote:
>jzh wrote in comp.lang.perl.misc:
>
>}     if ($_=~/^S/) {$unique{$_}=$_ }
>
>As you're not using the value in this hash, you can save some memory by
>doing "$unique{$_} = 1".

You can save further memory (and a little bit of time) by using

  undef $unique{$_}

instead.  You'll then have to use exists() if you need to check for the
existence of a particular key, though, since the value will be undefined
either way.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: Wed, 10 Oct 2001 21:13:14 +0200
From: "Mr. Mostrom" <mostromx32s@x32siname.com>
Subject: Sorting larg arrays
Message-Id: <%31x7.3843$Ad3.13936@nntpserver.swip.net>

Hello!

Is it possible to sort an array of more then 100.000 entries in a fast way?

For example (running under Unix/Linux):

#!/usr/bin/perl
#
# Filename: example.pl
#

@DIRS="/to/dir1 /to/dir2 /to/dir3";

foreach $DIR (@DIRS) {
    @FILES = `find $DIR`;
    @TOTAL = (@TOTAL, @FILES);
}

#
# Say, we now have 100.000 files in @TOTAL
# Which is the quickest way to sort it, or
# is it not doable, thinking about the time.
#
# I Want this do be done it just a second or two.
#

#
# End of example 
#

Thankful for any suggestions!

Cheers,

Efraim
-- 
// Remove <x-3-2-1-s> from my adress to reply //





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

Date: Wed, 10 Oct 2001 22:15:46 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Sorting larg arrays
Message-Id: <9q2a84$3i0$06$1@news.t-online.com>

"Mr. Mostrom" <mostromx32s@x32siname.com> schrieb im Newsbeitrag
news:%31x7.3843$Ad3.13936@nntpserver.swip.net...
> Is it possible to sort an array of more then 100.000 entries in a fast
way?

Yes or no. Depends on what you consider fast. Depends on the data. Depends
on what you want to sort it by.
The normal sort function that comes with Perl took 1.5 seconds per
iteration. (source code below)

#!perl
use strict;
use warnings;
use Benchmark;

# generate array of 100_000 elements of random 20 char strings.

 ...

timethis( $iterations, sub {my @tmp = sort @array;} );

Steffen





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

Date: Wed, 10 Oct 2001 22:24:49 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Sorting larg arrays
Message-Id: <9q2aoi$3a0$01$1@news.t-online.com>

"Steffen Müller" <tsee@gmx.net> schrieb im Newsbeitrag
news:9q2a84$3i0$06$1@news.t-online.com...
> The normal sort function that comes with Perl took 1.5 seconds per
> iteration. (source code below)

Forgot to mention that this is a Celeron 566MHz with sufficient RAM.




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

Date: Wed, 10 Oct 2001 21:38:35 GMT
From: "Tim Clark" <cpdog@nospam.com>
Subject: Re: split into filename and extension (need help before I go insane)
Message-Id: <vd3x7.342$x%4.321386@news1.news.adelphia.net>


"JHWB" <johan@basberg.comNOSPAM> wrote in message
news:9q16q3$4or$1@maud.ifi.uio.no...
> Ok, I have spent hours trying to figure out this simple task:
>
> how to split a filename into the name and the extension when the filename
> is:
> 1. any length
> 2. ends in either .jpg eller .gif
> 3. can include any character in the name

How about ($name,$ext)=split(/\.(gif|jpg)$/,$filename);





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

Date: 10 Oct 2001 21:59:28 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: split into filename and extension (need help before I go insane)
Message-Id: <1002750885.8353@itz.pp.sci.fi>

In article <9q16q3$4or$1@maud.ifi.uio.no>, JHWB wrote:
>Ok, I have spent hours trying to figure out this simple task:
>
>how to split a filename into the name and the extension when the filename
>is:
>1. any length
>2. ends in either .jpg eller .gif
>3. can include any character in the name
>
>As I have to insert a date between the name and the extension I (think I)
>will be using two variables $name and $ext.

TIMTOWTDI.  You can insert the date directly, for example:

 $filename =~ s/\.(jpg|gif)$/$date.$1/  or die "match failed";

This assumes you have the variables $filename and $date containing what
their names would suggest.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: Wed, 10 Oct 2001 14:09:25 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Stop Transversal of a Directory with Tar and Unzip
Message-Id: <27805-3BC49CE5-16@storefull-241.iap.bryant.webtv.net>

> goldbb2@earthlink.net (Benjamin=A0Goldberg) 
> Well, I dunno about whether using one 
> -x would work [or even if it should], but > you definitely can't just
use ".." and "~", > since -x requires a glob of files, not just > string
to check for being a substring. 

I understand, here's a test that I ran for -x, and it excludes the files
that match the patterns, if I type it like this:
 
`unzip -qjnCL $tmpfile -x "*\.pl" "*readme*" "*\.ht" "*\.exe" -d $tmpdir
2>&1`

The strange thing is that if I break the above into more readable lines
(below), the -x doesn't work. Any idea why?

`unzip -qjnCL $tmpfile 
    -x "*\.pl" "*readme*" "*\.ht" "*\.exe" 
    -d $tmpdir 2>&1`

Regards,
--Dennis



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

Date: 10 Oct 2001 19:18:43 +0100
From: nobull@mail.com
Subject: Re: Why dosen't this work?
Message-Id: <u9u1x7jr3w.fsf@wcl-l.bham.ac.uk>

"Chris Schadl" <cschadl@nospam.satan.org.uk> writes:

> If I use the following code to recursivly traverse a directory...

 ...then you are a masochist.  Use File::Find to recursivly traverse
directories.

[ snip home-rolled find based on glob() ]

> ...it works fine unless one of the directories happens to have a space in
> it.

> What's the deal?

glob() simluates the behaviour of Unix shell word splitting/globing.

The following are more or less equivalent:

my @y = split / /, `echo -n $x`;
my @y = glob($x);

In Unix shell an unquoted space is treated as a word separator.

glob() is handy in quick-and-dirty routines.  For serious programs use
opendir/readdir (unless of course you should be using File::Find in
the first place).

>  Is this a bug in the version of perl (5.6.0) I'm using?

No.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 10 Oct 2001 18:36:04 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Why dosen't this work?
Message-Id: <x71ykb8hqf.fsf@home.sysarch.com>

>>>>> "CS" == Chris Schadl <cschadl@nospam.satan.org.uk> writes:

  CS>     for (<$path/*>) {

  CS> ...it works fine unless one of the directories happens to have a space in
  CS> it.  If that is the case, then I get output like this:

  CS> Unaccompanied
  CS> Sonata
  CS> No.
  CS> 3
  CS> in
  CS> C


  CS> For some reason, spaces are getting transformed into newline
  CS> chars.  What's the deal?  Is this a bug in the version of perl
  CS> (5.6.0) I'm using?

it is not a bug in perl but in globbing. the shell returns the file
names with spaces and then splits on the white space so you actually see
each word as a separate file. use opendir/readdir and you
won't have that problem as it reads the directory without the use of the
shell. 

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: 10 Oct 2001 19:25:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Why dosen't this work?
Message-Id: <slrn9s9841.t26.abigail@alexandra.xs4all.nl>

Chris Schadl (cschadl@nospam.satan.org.uk) wrote on MMCMLXII September
MCMXCIII in <URL:news:pan.2001.10.10.12.38.47.316.5178@nospam.satan.org.uk>:
~~ If I use the following code to recursivly traverse a directory:
~~ 
~~ #!/usr/bin/perl
~~ 
~~ use strict;
~~ 
~~ my $path = $ARGV[0];
~~ 
~~ print_dir($path);
~~ 
~~ exit;
~~ 
~~ sub print_dir($) {
~~     my $path = shift;
~~ 
~~     for (<$path/*>) {
~~         if (-d $_) {
~~             print_dir($_);
~~         } else {
~~             print "$_\n";
~~         }
~~     }
~~ }
~~ 
~~ ...it works fine unless one of the directories happens to have a space in
~~ it.  If that is the case, then I get output like this:

Or it fails if there are symbolic links creating a loop.

Is there a reason you aren't using File::Find? Or just "find"?



Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


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

Date: Wed, 10 Oct 2001 16:28:24 -0400
From: "Joseph" <boogiemonster@usa.net>
Subject: win32::TieRegistry Print problem...
Message-Id: <9q2b4j$p4n$1@usenet01.srv.cis.pitt.edu>

I'm trying to connect to a remote machine and see what values are listed in
specific key.  My following code is...

1 use Win32::TieRegistry;
2
3 if( $Machine = $ARGV[0] )
4 {
5   $remMachKey = $Registry->Connect( $Machine, "LMachine",
{Delimiter=>"/"} )
6      or die "Can't Connect to $Machine HKEY_LOCAL_MACHINE key: $^E\n";
7 }

one keeps telling me there is an error on line 4, near ")  {"
but I do not see any.  I'm also trying to open a a subkey to delete it.  If
anyone uses Win32::TieRegistry connecting to a remote machine and have a
snippet of code they would like to share i would greatly appreciate it.




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

Date: Wed, 10 Oct 2001 18:25:54 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: zipping files?
Message-Id: <So0x7.883929$ai2.68061045@bin2.nnrp.aus1.giganews.com>

I am on a Win NT system.  I have a directory with various files.  I would
like to pull files with a certain extention and put them into a new zip file
with a specific name.  Does anyone know if and how this could be done?  I
know how to pull the files I want, but I don't know how or if Perl can zip
them up.  Any information would be appreciated.

Jess




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

Date: Wed, 10 Oct 2001 20:43:49 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: zipping files?
Message-Id: <Xns9136D2E49B6CFLaocooneudoramailcom@62.153.159.134>

Try the Archive::Zip module on CPAN 
http://search.cpan.org/search?mode=module&query=Archive%3A%3AZip


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

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


------------------------------
End of Perl-Users Digest V10 Issue 1907
***************************************


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