[7797] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1422 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 6 02:07:48 1997

Date: Fri, 5 Dec 97 23:00:24 -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           Fri, 5 Dec 1997     Volume: 8 Number: 1422

Today's topics:
     Re: 001 + 1 = 002; 002 - 1 = 1 ARGH (Jim Littlefield)
     Re: 001 + 1 = 002; 002 - 1 = 1 ARGH (Mike Stok)
     Re: ^M removal <rets@meta3.com>
     Re: ^M removal (Gabor)
     Re: can perl do multi-threaded programming? (Malcolm Beattie)
     Re: Dynamic text-to-GIF utility <ghowland@hotlava.com>
     Extended DOS characters <josh@jersey.net>
     Re: Extended DOS characters <dballing@speedchoice.com>
     Re: forked processes not exiting (Robert G. Ferrell)
     Re: Fully qualifying variables (Andrew M. Langmead)
     Help with VERY simple problem (Jason Thomas Hitesman)
     How to create a DLL using PERL?  How to write a DLL in  <defaultuser@domain.com>
     Re: How to create reference to anonymous scalar variabl (Andrew M. Langmead)
     Re: How to create reference to anonymous scalar variabl (Andrew M. Langmead)
     Re: How to create reference to anonymous scalar variabl (Greg Bacon)
     NEWBIE can't tar latest_tar.gz <Nick1pub@worldnet.att.net>
     Re: Newbie Seeking Perl Archives for programming exampl (Dan Roberts)
     Re: Newbie Seeking Perl Archives for programming exampl (Dan Roberts)
     Re: old regular expression question (Bob Wilkinson)
     Re: Perl Overhead <robert.friberg@your_clothes.eductus-vast.com>
     Re: problem with unlink <tycage@infi.net>
     Re: problem with unlink <rets@meta3.com>
     Re: Problems with .db files <rets@meta3.com>
     Q: background process in Perl for a CGI <lwest@imaginet.fr>
     recursing sub directories (Robert Brody)
     Re: Retrieving keys/values from %param in creating orde (Mike Stok)
     use CGI (Thomas Paine)
     Re: use CGI (Honza Pazdziora)
     Re: use CGI (Robert G. Ferrell)
     Win32-Perl:  How to get location of NT system directory <sdcairns@mindspring.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 5 Dec 97 14:42:39 GMT
From: little@ragnarok.hks.com (Jim Littlefield)
Subject: Re: 001 + 1 = 002; 002 - 1 = 1 ARGH
Message-Id: <slrn68g4mv.k2l.little@ragnarok.hks.com>

On Fri, 05 Dec 1997 10:56:46 GMT, Bart Lateur <bart.mediamind@tornado.be> wrote:
>
>Ok. So what comes after "a999"?

That's an easy one. It is "b000".

--
Jim Littlefield                  "How do you tell when you run out of
                                  invisible ink?" - Steven Wright



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

Date: 5 Dec 1997 14:56:27 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: 001 + 1 = 002; 002 - 1 = 1 ARGH
Message-Id: <6694mr$okl@news-central.tiac.net>

In article <348cdb18.9232288@news.tornado.be>,
Bart Lateur <bart.mediamind@tornado.be> wrote:
>Tom Phoenix <rootbeer@teleport.com> wrote:
>
>>> I checked the book and indeed only the ++ op is magical (I wonder
>>> why?).
>>
>>Probably because there's no obvious predecessor to 'a000', for example.
>
>Ok. So what comes after "a999"?
>
>	Bart.

'b000' maybe.

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 05 Dec 1997 08:52:02 -0600
From: Ken Holm <rets@meta3.com>
To: Buxx <buxx@buxx.com>
Subject: Re: ^M removal
Message-Id: <34881512.7DE1@meta3.com>

Buxx wrote:
> 
> I need to strip out ^M characters from files I've copied from
> MSDOS files
> 
> s/<?>//g;

s/\cM//g;

-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: 5 Dec 1997 15:56:40 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: ^M removal
Message-Id: <slrn68g8m4.l81.gabor@vinyl.quickweb.com>

In article <34872361.5A78@buxx.com>, Buxx wrote:
- I need to strip out ^M characters from files I've copied from 
- MSDOS files
- 
- s/<?>//g;

from command line
tr -d \\r < infile > outfile

in perl
tr/\r//d;
or
s/\r//;
or
s/\cM//;
or
s/\cM$//;

take your pick.

gabor.
--
    If you want to see useful Perl examples, we can certainly arrange to
    have comp.lang.misc flooded with them, but I don't think that would
    help the advance of civilization.  :-)
        -- Larry Wall in <1992Mar5.180926.19041@netlabs.com>


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

Date: 5 Dec 1997 14:21:56 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: can perl do multi-threaded programming?
Message-Id: <6692m4$6b7$1@news.ox.ac.uk>

In article <3486E9CA.407B@zeegee.com>, Eryq  <eryq@zeegee.com> wrote:
>On a slightly-related issue regarding 5.005:
>
>Up until now, I've worked with the assumption that signal
>handlers in Perl must follow the traditions of their C cousins:
>avoid non-reentrant malloc and stdio libraries 
>at all costs... so, for example, your Perl sighandler *can* safely use 
>syswrite() for output, and it *can* set a pre-declared scalar variable 
>to an integer or a float (or a string which will fit in the 
>scalar's current buffer), and it *can* call subroutines which 
>do only these things... but little else.
>
>Now, sfio (I believe) allows for reentrancy, and it seems that
>any malloc used by a thread-safe Perl would have to be reentrant
>as well.  So... does this mean that signal handlers under 5.005
>will no longer have to walk on eggshells to avoid core dumps?

There are two ways to allow arbitrary perl code to be usable from
signal handlers. One is Chip's way which has the advantage that a
multi-threading perl isn't required but has the disadvantage that
perl's internal loop has to poll after every few instructions
whether a signal has been raised or not. The other is the way that
I've included in the threading stuff: it has the disadvantage that
a multi-threaded perl is required but the advantage that no polling
is necessary in perl's internals. The multi-threaded safe signal
handling works by creating a special thread which sits there
blocking waiting to be notified that a signal has arrived. The
real C signal handler merely notifies the signal thread (safely)
about the arrival of the signal. The signal handling thread then
executes whatever perl code you like. So if you include
    use Thread::Signal;
at the top of your program (and wait until I've polished up the
internals a bit to complete things) then you can write signal
handlers that do whatever you like completely safely and without
affecting the performance of your main program. Note, however,
that a perl compiled with multi-threading support
(./Configure -Dusethreads) is intrinsically slower than perl
compiled without because of the extra dereferencing necessary.

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger


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

Date: Fri, 05 Dec 1997 15:10:37 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: Dynamic text-to-GIF utility
Message-Id: <34880B5D.4A34@hotlava.com>

Tushar Samant wrote:
> 
> smanes@nospam.evermagpie.com writes:
> >I'm looking for a freeware tool which will generate an on-the-fly
> >GIF given some text, a font style from a local database and, ideally,
> >a background GIF.  Oh yeah, and it has to run on Linux.
> 
> I do this with an X font server, ImageMagick (a truly excellent product),
> and PerlMagick. Yes, all of it runs on a Linux box. I am sticking to the
> "arbitrarily resizable" fonts, because the arithmetic is easier (and I know
> next to nothing about fonts). Given that, the advantages of this approach
> are: you can add almost any font you want to; the results are always clean
> and pleasant; you are not restricted to gifs, etc. We are definitely not
> going to use GD for this again. The disadvantage is, you can't really do
> it on the fly.

I agree - ImageMagick/PerlMagick is best used for images created
offline, and especially for images where fancy effects are required,
along with proportional fonts and aliasing.  GD is more suited for
simple on the fly image generation, using fixed spaced bitmapped fonts
(without any aliasing).

Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: Fri, 05 Dec 1997 11:12:19 -0500
From: Josh <josh@jersey.net>
Subject: Extended DOS characters
Message-Id: <348827E3.40DB@jersey.net>

Does anyone know how to print and use extended characters in Perl.  i.e.
chr$(181).  If possible, could you please respond via email.  Thanks. 
Josh
josh@jersey.net


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

Date: Fri, 05 Dec 1997 10:52:56 -0600
From: Derek Balling <dballing@speedchoice.com>
To: Josh <josh@jersey.net>
Subject: Re: Extended DOS characters
Message-Id: <A6F1EC37F29189A0.94F0E9AF968D3CA2.051DD467C744ED52@library-proxy.airnews.net>

Josh wrote:
> 
> Does anyone know how to print and use extended characters in Perl.  i.e.
> chr$(181).  If possible, could you please respond via email.  Thanks.
> Josh
> josh@jersey.net

# perl -e 'print "\xB5 \n";'


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

Date: Fri, 5 Dec 1997 16:01:36 GMT
From: rferrell@usgs.gov (Robert G. Ferrell)
Subject: Re: forked processes not exiting
Message-Id: <EKq4Ip.MzM@igsrsparc2.er.usgs.gov>

In article <668t8t$r8b$1@apple.news.easynet.net>, dan@ukonline.co.uk 
says...
>They don't actually exit (using 'exit
>0;') , instead they become zombie processes. Anyone have any ideas, or 
>could
>point me in the right direction ?

You mean, say, the C/S example in the Camel book?  Each forked process 
should have its own exit statement that is invoked when the input buffer 
from the client is empty.  If this isn't happening, check to make sure 
first of all that there *is* an exit statement in your code.  If worse 
comes to worse, you could always grep ps for zombies and kill them that 
way.  Crude, but effective in a pinch.

HTH,

Robert G. Ferrell
USGS



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

Date: Fri, 5 Dec 1997 15:11:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Fully qualifying variables
Message-Id: <EKq27I.1rA@world.std.com>

Allen Choy <achoy@us.oracle.com> writes:

>I was wondering if anyone has a good explanation why the strict pragma
>would flag variables defined in a package needs to be fully qualified
>and not subroutines?

The 'strict vars' pragma doesn't require dynamically scoped variables
to be fully qualified because it fills some sort of Pascal-ish notion
of "correct" programming. it is done because it prevents some subtle
bugs, like one called "variable suicide". that these types of
variables. Fully qualifying the variable prevents some of these bugs.

Since subroutines aren't used in the same manner. They aren't aliased
to other names and passed to subroutines. They don't require the same
sort of protection.

-- 
Andrew Langmead


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

Date: Fri, 5 Dec 1997 16:32:51 GMT
From: jhitesma@oucsace.cs.ohiou.edu (Jason Thomas Hitesman)
Subject: Help with VERY simple problem
Message-Id: <EKq5yr.6A9@boss.cs.ohiou.edu>

Ok, I'm fairly sure that my problem here is laughably simple but I've just
wasted two hours staring at my code and can't figure out what's wrong.

I'm trying to read in a text file so that each the lines are stored in an
array here's what I'm using

(just the snippet of code I'm having problems with is included)

while (<PFILE>) {
	$rows[$i] = <PFILE>;
	$i++;
	}

However when I try to read in a three line text file I only get two lines
read in. 

Now it's been almost two years since I even touch a perl script but I
though I remembered more than this.  Even so a few hours with my copy of
the camel book hasn't help clear up this problem.

The file is being opened properly and is just three lines of plain ASCII
text with CRLF's on it.  I tried adding a chop; before the assignment
statement but it didn't make any difference.

Please can someone give me any hints as to what I'm over looking?

(BTW I'm sure the problem isn't with how I'm trying to print the array
[though I do have other problems there still :)] because $#rows is only
returning '1' as it's value.  So the above code is only getting 2 lines (0
and 1) out of my file.)

----
Jason Hitesman
http://frognet.net/~jhitema  <-- about me
http://www.osborn.com   <-- My Job


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

Date: Fri, 05 Dec 1997 11:43:19 -0500
From: billy <defaultuser@domain.com>
Subject: How to create a DLL using PERL?  How to write a DLL in PERL?
Message-Id: <34882F26.BCEFAD3@nowhere.com>

How to create a DLL using PERL?  How to write a DLL in PERL?

Is it possible to create  a win32 dll from PERL?  I know it is possible
to make a dll with visual BASIC.  I was wondering if anyone had actually
set up some API for making dlls written in perl.  I have seen many
posting asking how to use a dll in perl, but I was thinking that it
would be much more useful to make a perl dll that could be used in other
languages.  PERL has many unique features- it would be great if you
could call a string matching function from inside vc++.

My first thought was that there might be a program that could compile
perl code to c, from there it would be easy to build a dll...

Perhaps this is a difficult problem but I would have thought there would
be a package available somewhere, am I wrong?

Thank you,

anon

P.S. My apologies if this question has already been answered; I could
not easily find a related posting using an altavista usenet search.




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

Date: Fri, 5 Dec 1997 15:28:23 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How to create reference to anonymous scalar variable ?
Message-Id: <EKq2zB.D6v@world.std.com>

Margarit Nickolov <man@digsys.bg> writes:


>For example some elements of hash reference to one value of scalar
>variable, then value of scalar variable changes, and I want another
>elements of hash reference to 'new value' of the same scalar variable.

make a local variable with my() inside your while loop. Assing to that
local variable and make a reference to it. In the next iteration of
the block, you will get a new local.


while(defined($line = <FH>)) { # avoid the "0" bug.
  my $local = $line;
  $hash{ $key1 } = \$local;
  $hash{ $key2 } = \$local;
}
-- 
Andrew Langmead


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

Date: Fri, 5 Dec 1997 15:30:26 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How to create reference to anonymous scalar variable ?
Message-Id: <EKq32r.EKL@world.std.com>

tobez@plab.ku.dk writes:

>Margarit Nickolov wrote:
>> $hash{ $key1 } = \$line; # I want each iteration create some references
>> $hash{ $key2 } = \$line; # to the 'CURRENT VALUE' of scalar $line

>1.  Why do you need it?  Isn't that simplier just to assign a value
>instead of the reference?

One reason that I might guess is so that when you change
${$hash{$key1}} then ${$hash{$key2}} also changes.

-- 
Andrew Langmead


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

Date: 5 Dec 1997 15:42:24 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Margarit Nickolov <man@digsys.bg>
Subject: Re: How to create reference to anonymous scalar variable ?
Message-Id: <6697d0$h28$1@info.uah.edu>

[Posted and mailed]

In article <Pine.BSI.3.95.971205120403.3642A-100000@school.digsys.bg>,
	Margarit Nickolov <man@digsys.bg> writes:
: For example some elements of hash reference to one value of scalar
: variable, then value of scalar variable changes, and I want another
: elements of hash reference to 'new value' of the same scalar variable.
: 
: while( $line = <FH>) {
:   
: # value of 'scalar $line' changes each iteration
: 
: $hash{ $key1 } = \$line; # I want each iteration create some references
: $hash{ $key2 } = \$line; # to the 'CURRENT VALUE' of scalar $line
: 
: }

The key is to create a new scalar each time through:

    while (defined($line = <FH>)) {
        my $s = $line;

        $hash{$key} = \$s;
    }

There is no syntactically sugarous way of getting a reference to an
anonymous scalar like there is for anonymous arrays and hashes ([] and
{}).  In his book Advanced Perl Programming[1], Sriram Srinivasan
suggests the following technique

    my $ref;
    {
        my $scalar = 'foo';

        $ref = \$scalar;
    }
    ## $ref now refers to an anonymous scalar

[1] Advanced Perl Programming, ISBN 1-56592-220-4

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Fri, 05 Dec 1997 12:05:35 -0500
From: Nick Nottleman <Nick1pub@worldnet.att.net>
Subject: NEWBIE can't tar latest_tar.gz
Message-Id: <669c3o$spr@mtinsc05.worldnet.att.net>

I am trying to extract latest_tar.gz on a SCO Unix box. The command i am
using is tar xvf latest_tar.gz.  I am getting directory checksum
errors.  Any help for a Newbie??

Nick


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

Date: Fri, 05 Dec 1997 08:39:45 -0500
From: Roberts_Daniel_G.PriLVMS4@MSMAIL.BMS.COM (Dan Roberts)
Subject: Re: Newbie Seeking Perl Archives for programming examples
Message-Id: <Roberts_Daniel_G.PriLVMS4-0512970839460001@140.176.4.142>

Hello Brian..

Actually right now I would like to write a little prg that would rename a
file and also change the first line of the file contents to reflect the
new name

is..

the current filenames are of the form 12345.test.txt
they need to be changed to 12345.txt
and the first line of each file has to be changed from 
">test"

to 
">12345"
so that when the new file is loaded into a prg each of the files have a
unique name

Hope this makes sense!!.>Dan

-- 
Dan Roberts
BRISTOL-MYERS SQUIBB PHARM. RES. CENTER      "Nature is last at Bats"
PRINCETON, NEW JERSEY U.S.A. PLANET EARTH, MILKY-WAY GALAXY
<<<<INTERNET ADDRESS>>>>Roberts_Daniel_G.PriLVMS4@MSMAIL.BMS.COM



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

Date: Fri, 05 Dec 1997 08:41:28 -0500
From: Roberts_Daniel_G.PriLVMS4@MSMAIL.BMS.COM (Dan Roberts)
Subject: Re: Newbie Seeking Perl Archives for programming examples
Message-Id: <Roberts_Daniel_G.PriLVMS4-0512970841280001@140.176.4.142>

Hello Brian..

Actually right now I would like to write a little prg that would rename a
file and also change the first line of the file contents to reflect the
new name

is..

the current filenames are of the form 12345.test.txt
they need to be changed to 12345.txt
and the first line of each file has to be changed from 
">test"

to 
">12345"
so that when the new file is loaded into a prg each of the files have a
unique name

Hope this makes sense!!.>Dan

-- 
Dan Roberts
BRISTOL-MYERS SQUIBB PHARM. RES. CENTER      "Nature is last at Bats"
PRINCETON, NEW JERSEY U.S.A. PLANET EARTH, MILKY-WAY GALAXY
<<<<INTERNET ADDRESS>>>>Roberts_Daniel_G.PriLVMS4@MSMAIL.BMS.COM



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

Date: Fri, 05 Dec 1997 14:09:04 +0100
From: b.wilkinson@pindar.com (Bob Wilkinson)
Subject: Re: old regular expression question
Message-Id: <b.wilkinson-0512971409040001@ip57-york.pindar.co.uk>

In article <347ACC65.FE2B5FB6@ny.ubs.com>, Ian Goldstein
<nygsi@ny.ubs.com> wrote:

> I  know this was covered before... but it escapes me.
> 
> I have a variable with 6 digits . I want to split this into 2 variables
> of 3 digits each.
> $var=123456;
> ($var1,$var2) = split(/\(\d\d\d\)\(\d\d\d\)/, $var);
> 
> This does not seem to work. What am I missing.
> Thanks in advance.
> 
> --
> Ian

You don't need to split, and you don't need to escape the bracket characters.

viz.

#!/usr/local/bin/perl -w
$var=123456;
($var1,$var2) = $var =~ /(\d\d\d)(\d\d\d)/;
print "1 is $var1, 2 is $var2\n";

Bob

-- 
 .sig file on holiday


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

Date: 4 Dec 1997 18:47:49 GMT
From: "Robert Friberg" <robert.friberg@your_clothes.eductus-vast.com>
Subject: Re: Perl Overhead
Message-Id: <01bd00e5$17136620$c82da8c0@akilles.ittek.org>

> Questions:
> 1 - Is this true (the one process for each instance bit)?
> 2 - How much additional overhead does each of these processes use?
> 3 - How many concurrent processes would it take to make a significant
> impact on a 200 MHz Pentium Pro w/ 128MB RAM?
> 4 - What can I do with Perl that they can't do with Cold Fusion?
***************************************************************************
1) Depends. You can avoid this by using the Perl for ISAPI-dll of 
   the ActiveState port. It requires an ISAPI-compliant server.

2,3) The DLL mentioned above is free and simple to use, there's
     no reason not to, so the questions aren't an issue. 

4) Cold Fusion is a markup-language, perl is a programming language.
   Anything done with Cold Fusion can be done with perl as well.
   A few things from the top of my mind that you could do with 
   perl in context of web based database interaction: 
      * interact with other windowsapps through OLE
      * make a robot/spider
      * implement your own serverapplication
      * have an email interface instead of a webbased
      * twitch the registry
      * set filepermissions
      * twitch the user-database
      * launch other processes/threads
      * twitch the NT-logs
   Your imagination is the limit. 

   Besides cgi I use perl for:
      * NT-logon scripts
      * statistics from httpd/logs/access_log
      * user administration
      * building sitemaps, index's, toc's, etc
      * and lot's more!

   Some other advantages:
      * There are modules for _everything_.
      * perl is free
      * the source is available
      * good support on c.l.p.m
      * crossplatform capabilities

-- 
Hope this helps,
robban
robert.friberg(a)eductus-vast.com
perl -e 'print `banner "Just another perl hacker"`'


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

Date: Fri, 05 Dec 1997 09:27:45 -0500
From: Ty Cage Warren <tycage@infi.net>
Subject: Re: problem with unlink
Message-Id: <34880F61.155148DC@infi.net>

Ernst wrote:
> 
> Hi
> 
> I am trying to delete a file form a directory, using unlink like this:
> 
> unlink ("/Master/docs/upload/HejKurt.doc");
> 
> but i won't work.
> Any ideas??

Does your script run as a user with permissions to unlink this file?
You might want to try this

unlink("whatever") or die "Can't unlink file: $!";

so that you are told why it doesn't unlink.

Hope this helps,
   Ty

-- 
+---+
Ty Cage Warren                                           tycage@infi.net
Systems Engineer                                                 InfiNet
Homepage: http://tazer.engrs.infi.net/~tycage
PGP Public Key: http://tazer.engrs.infi.net/~tycage/pgpkey.html
PGP Fingerprint: FF C1 28 CA 80 B5 31 78  B1 24 2E 8C AB DA FB D2
------------->Never invoke anything bigger than your head.<-------------


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

Date: Fri, 05 Dec 1997 09:02:15 -0600
From: Ken Holm <rets@meta3.com>
To: e.christensen@netjob.dk
Subject: Re: problem with unlink
Message-Id: <34881777.6201@meta3.com>

Ernst wrote:
> 
> Hi
> 
> I am trying to delete a file form a directory, using unlink like this:
> 
> unlink ("/Master/docs/upload/HejKurt.doc");
> 
> but i won't work.
> Any ideas??
> 
> mvh
> Ernst
> e.christensen@netjob.dk

If you use:

unlink ("/Master/docs/upload/HejKurt.doc") || die "[$!]\n";

Perl will tell you if it encounters a problem.

My guess is : "Permission denied"

-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: Fri, 05 Dec 1997 09:00:08 -0600
From: Ken Holm <rets@meta3.com>
To: Fabian Warkalla <warkalla@ecrc.de>
Subject: Re: Problems with .db files
Message-Id: <348816F8.4487@meta3.com>

Fabian Warkalla wrote:
> 
> Hi !
> I want to save a hash in a db file and define and undefine elements in
> this has (which normally works, when the hash is not connected to a file
> !).
> Why does the undef function not work with this context ???
> Why is the variable $ALIAS{xxx} not undefined (only the content is
> undefined !) ?
> 

- Cut---

Couple of things here:

* Instead of using dbmopen, use the DB_File mod with tie.
* Secondly, there are some really good examples of how to use DB_File
  with tie in Camel v.2 pp. 387-394.
* Finally, using delete 'deletes the entry from the DBM file.' (Camel
v.2 p. 156)

-K

-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: Fri, 05 Dec 1997 14:56:27 +0100
From: Leo West <lwest@imaginet.fr>
Subject: Q: background process in Perl for a CGI
Message-Id: <3488080B.30BA243F@imaginet.fr>

In a CGI program, that makes a calculation for quite a long time,
i'd like to send the HTML page to the user before the script process
ends.
I tried several kind of forks (2 forks, killing the first child)
but the httpd always waits until the parent and children process both
end.

Any idea anyone ?

Leo




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

Date: Fri, 05 Dec 1997 15:21:58 GMT
From: rabrody@earthlink.net_NOSPAM (Robert Brody)
Subject: recursing sub directories
Message-Id: <34891bc6.85138418@news.earthlink.net>

Hi.  In reading the posts and DejaNews, I came across a very handy
Perl command to search/replace text in files in an entire directory.

  perl -pi -e 's/old/new/g' *

Varients of this were also exampled, such as attaching a suffix to the
original file, eg., -pi.bak, or specifying a specific filename pattern
instead of an asterisk, and so forth.

Can this command be extended to recurse all subdirectories from the
current directory?  I've been handed a project that involves my
combing through 8,000 files laid out in a hierarchy of 157
directories, some tiers going six or seven deep.  The task is to
change an old absolute URL to a new one.  E.g.,

    perl -pi -e 's/www.old-company.com/www.new-company.com/g' *

I could manually enter each directory and run the command on that
directory, but I suspect Perl could recurse the directories for me
instead.  Yes?  I'm reading man pages as fast as I can <g> but I don't
want to screw this up or blast binary files, etc.  A little knowledge
can be dangerous.

Which brings me to another question.  Any particular book or source of
information that you would recommend for a newcomer to Perl?  I have
programming experience, not a lot but enough to understand what's
going on in general.

Thanks.

If emailing, please remove _NOSPAM from my address.


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

Date: 5 Dec 1997 14:23:37 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Retrieving keys/values from %param in creating order?
Message-Id: <6692p9$mpr@news-central.tiac.net>

In article <348427C0.41C6@mashie.ece.jhu.edu>,
Chenyang Xu  <chenyang@mashie.ece.jhu.edu> wrote:
>Hello,
>
>   I am wondering how to retrieve keys/values pair from associate array
>say %param in the order they are created.
>
>   Thanks for any suggestions and help.

One thiong you might do is use the Tie::IxHash module which can be found
on any CPAN site.  The README says:

This is the README file for Tie::IxHash, the Perl module that 
implements ordered in-memory associative arrays.

It requires:
   Perl Version 5.003 or later.

If you have been led to believe that associative arrays in perl
don't preserve order, and if you have ever craved for that feature,
this module is for you.  Simply declare a "tie" for the hash variable
that you want to be order-preserving, and forget that limitation
ever existed.  You can do other nifty things with the tied hash object
that you may be used to doing with arrays, like Push(), Pop() and 
Splice().

If you don't know what "tie" means, you should look at the
perltie(1) manpage in a recent perl distribution, or in the
index of one of the numerous books on perl.

If you don't know what "perl" is, you don't need this software.
 
See the embedded documentation in the module file for details.

Don't forget to send your comments!

 - Sarathy.
   gsar@umich.edu

Hope this helps,

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 05 Dec 1997 15:28:12 GMT
From: paineta@edp.net (Thomas Paine)
Subject: use CGI
Message-Id: <6696ed$5ku$1@news.inc.net>
Keywords: CGI

I have a perl script that was running on a DEC Alpha machine and it had the 
following line.

use CGI qw(:standard);

I am trying to make this script run on a NT web server, but I am not having 
much luck.  Could someone possibly point me in the right direction.


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

Date: Fri, 5 Dec 1997 16:35:02 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: use CGI
Message-Id: <adelton.881339702@aisa.fi.muni.cz>
Keywords: CGI

paineta@edp.net (Thomas Paine) writes:

> I have a perl script that was running on a DEC Alpha machine and it had the 
> following line.
> 
> use CGI qw(:standard);
> 
> I am trying to make this script run on a NT web server, but I am not having 
> much luck.  Could someone possibly point me in the right direction.

If you do not have much luck, you probably receive some error messages
or you experience other strange behaviour. Other people can only guess
what is going wrong if you do not tell us. So, what is the problem
except you net being lucky?

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 5 Dec 1997 16:56:17 GMT
From: rferrell@usgs.gov (Robert G. Ferrell)
Subject: Re: use CGI
Message-Id: <EKq71u.3Lo@igsrsparc2.er.usgs.gov>
Keywords: CGI

In article <6696ed$5ku$1@news.inc.net>, paineta@edp.net says...

>use CGI qw(:standard);

CGI.pm is a Perl module for processing CGI scripts. It would help if 
you'd be little more specific about the problem (what error messages, 
etc), but offhand I'd say that possibly you don't have CGI.pm on your NT 
machine, or the path to it isn't in your system path.

HTH,

Robert G. Ferrell
USGS



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

Date: 5 Dec 1997 15:05:57 GMT
From: "Scott Cairns" <sdcairns@mindspring.com>
Subject: Win32-Perl:  How to get location of NT system directory?
Message-Id: <01bd018e$6c9faeb0$d4000080@ccu09>

Subject says it all?  I need to Win32:Spawn() an executable in the
Winnt/system32 directory but I cannot guarantee that this directory is
either called "winnt" or is on the user's C: drive.  How can I find out the
root directory where NT (4.0) is installed?



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

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

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