[16840] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4252 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 7 21:05:28 2000

Date: Thu, 7 Sep 2000 18:05:15 -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: <968375115-v9-i4252@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 7 Sep 2000     Volume: 9 Number: 4252

Today's topics:
    Re: [Q] Matching newlines using . and /s <stephenk@cc.gatech.edu>
    Re: [Q] Matching newlines using . and /s <lr@hpl.hp.com>
        Algorithm for data recognition awrobinson@my-deja.com
    Re: Alta-Vista Remarq Access? Now costs 13.95 a Month? <sysnovice@my-deja.com>
    Re: Beginner question about extracting data from file <lr@hpl.hp.com>
    Re: Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <mischief@motion.net>
    Re: Bug in perl 5.005_03 or 5.003_01? ("my" and loops) (Abigail)
        CGI & hashes <kelley.a.kent@intel.com>
    Re: CGI programming book (Tim Hammerquist)
    Re: confusing error msg <lr@hpl.hp.com>
    Re: confusing error msg (Abigail)
    Re: Date Related Issue <lbg-goeff@powerup.com.au>
    Re: Export data to an Excel spreadsheet? <matt.stoker@motorola.com>
    Re: golf: remove .txt from filenames <matt.stoker@motorola.com>
    Re: golf: remove .txt from filenames <matt.stoker@motorola.com>
    Re: golf: remove .txt from filenames <wyzelli@yahoo.com>
    Re: golf: remove .txt from filenames (Abigail)
    Re: how to restart apache thedrag@--X--houston.rr.com
    Re: memory leak with subroutine references (Logan Shaw)
    Re: perl book? <kelley.a.kent@intel.com>
    Re: perl book? <kelley.a.kent@intel.com>
    Re: perl book? <care227@attglobal.net>
    Re: perl book? (Abigail)
    Re: Regards CGI.pm <kenn_mar@hotmail.com>
        return values from system() function <clittle@mmcable.com>
    Re: return values from system() function <tony_curtis32@yahoo.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 07 Sep 2000 18:12:44 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: [Q] Matching newlines using . and /s
Message-Id: <39B812DC.793A81C0@cc.gatech.edu>

Anshuman Pandey wrote:

> Hello,
>
> I have a small program which processes text found within a specified
> delimiter. The program is supposed to modify text found only between
> "{\macro" and "}", e.g. "{\macro abcdef}.  Here is the program:
>
>         while (<>) {
>            s/\{\\macro (.*?)\}/transform()/gse;
>            print;
>         }
>
>         sub transform {
>             $text = $1;
>             $text =~ tr/abc/xyz/;
>             "{\\macro $text}";
>         }
>
> However, the program works only on text which does not contain newlines.
> The program fails to do the transformation on text like:
>
>         {\macro abcdef
>             fedcba}
>
> I understand that "." does not match newlines unless the "s" operator is
> specified. I also added the "m" operator to the operator list, but that
> did not grant success either. I have checked the documentation found in
> perlre and perlop, and according to what I've read, the above code should
> work. Is there something that I have overlooked?
>

You are reading the file one line at a time before applying the
transformation.  If you want to match regexes across multiple lines, read the
entire file into one string, or use a different delimeter.  I recommend:
local $/ = undef;        # slurp mode (perldoc perlvar)
$_=<>;
s/\{\\macro (.*?)\}/transform()/gse;
print;

--
Stephen Kloder               |   "I say what it occurs to me to say.
stephenk@cc.gatech.edu       |      More I cannot say."
Phone 404-874-6584           |   -- The Man in the Shack
ICQ #65153895                |            be :- think.




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

Date: Thu, 7 Sep 2000 15:48:28 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: [Q] Matching newlines using . and /s
Message-Id: <MPG.1421bb1766a4385e98ad3c@nntp.hpl.hp.com>

In article <Pine.A41.4.21.0009071418390.33222-
100000@vergil01.u.washington.edu> on Thu, 7 Sep 2000 14:20:09 -0700, 
Anshuman Pandey <apandey@u.washington.edu> says...

 ...

+ I have a small program which processes text found within a specified 
+ delimiter. The program is supposed to modify text found only between 
+ "{\macro" and "}", e.g. "{\macro abcdef}.  Here is the program:
+ 
+ 	while (<>) {
+ 	   s/\{\\macro (.*?)\}/transform()/gse;
+ 	   print;
+ 	}
+ 
+ 	sub transform {
+ 	    $text = $1;
+ 	    $text =~ tr/abc/xyz/;
+ 	    "{\\macro $text}";
+ 	}
+ 
+ However, the program works only on text which does not contain
+ newlines.  The program fails to do the transformation on text like:
+ 
+ 	{\macro abcdef
+             fedcba}
+ 
+ I understand that "." does not match newlines unless the "s" operator
+ is specified. I also added the "m" operator to the operator list, but
+ that did not grant success either. I have checked the documentation
+ found in perlre and perlop, and according to what I've read, the above
+ code should work. Is there something that I have overlooked?

Indeed.  Your code reads one line at a time, so the regex cannot match a 
string that spans line boundaries.  You will have to read the entire 
file into one string before processing it.

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


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

Date: Thu, 07 Sep 2000 23:16:15 GMT
From: awrobinson@my-deja.com
Subject: Algorithm for data recognition
Message-Id: <8p97jd$s7n$1@nnrp1.deja.com>

I've got data coming in through email. I need to do two things with it.
First, I need to account for multi-part mime messages and figure out
which mime part contains the data. Second, I need to determine if
records have been wrapped and unwrap them. I've build a regular
expression that represents a single data record. With the regular
expression, I can do either 1. or 2. I just haven't figured out how to
do both at the same time. Could some kind soul point me to an algorithm,
reference, or idea that would get me over this hump?

Thanks!

Andrew Robinson


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 07 Sep 2000 22:54:07 GMT
From: Greg Donovan <sysnovice@my-deja.com>
Subject: Re: Alta-Vista Remarq Access? Now costs 13.95 a Month?
Message-Id: <8p96a6$qid$1@nnrp1.deja.com>

Thanks Mr Nobull.
I appreciate you answering my non-perl question.
I didn't have a clue where to ask this question.
I'm glad there are a few samaritans out there ;)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 7 Sep 2000 15:39:37 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Beginner question about extracting data from file
Message-Id: <MPG.1421b9069019cbd698ad3a@nntp.hpl.hp.com>

In article <85Ut5.2562$O5.51183@news.itd.umich.edu> on Thu, 07 Sep 2000 
21:51:00 GMT, Sean McAfee <mcafee@waits.facilities.med.umich.edu> 
says...
> In article <MPG.14205c5c8ef332e98ad2f@nntp.hpl.hp.com>,
> Larry Rosler  <lr@hpl.hp.com> wrote:
> >The right direction is a two-dimensional data structure, a hash-of-hash-
> >references keyed off the user names.  The user names needn't be repeated 
> >in the hashes that contain the associated values (password and alias).
> 
> >/([^,]+),\s+([^,]+),\s+"([^@]+)/ and
> >    @{$users{$1}{@fields[1, 2]}} = ($2, $3) while <DATA>;
> 
> Was the above array assignment perhaps meant to be:
> 
> @{$users{$1}}{@fields[1,2]} = ($2, $3)
> 
> ?  As written, @fields[1,2] is a list in scalar context, and so evaluates
> to just $fields[2].  The code also creates a data structure that is a
> hash-of-hash-of-array, not a hash-of-hash as advertised.

Yes.  The program shown works either way (provided the print statement 
matches the creation statement), but uses different data structures.  I 
tried it both ways and picked the wrong one.

Object lesson:  It would have been better to use Data::Dumper instead of 
a matching print to see what is really going on.

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


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

Date: Thu, 7 Sep 2000 17:38:09 -0500
From: "Chris Stith" <mischief@motion.net>
Subject: Re: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <srg645noljn134@corp.supernews.com>

"Heiter" <heiter@astro.univie.ac.at> wrote in message
news:39AE8CFF.C4E5B213@astro.univie.ac.at...
> Hi,
>
> Recently I found a part of code in a perl script, which
> behaved differently under two versions of perl.
> Consequently, there must be a bug in one of the versions,
> but I don't know which one behaves correctly.

Either, since the semantics for altering an array while foreach
loops over it are undefined.

> Here is a simple test code:
>
> my @test_array = (1,2,3,4,5,6);
> foreach (@test_array) {
>    print shift(@test_array)."\n";
> }
>
> The output was
> under perl, version 5.003_01 (+ suidperl security patch),
> installed on a dec unix alpha workstation:
> 1
> 2
> 3
> 4
> 5
> 6

This is what would be done if you wrote this:


my @test_array = (1,2,3,4,5,6);
foreach $foo (@test_array) {
   print $foo ."\n";
}

or this:

my @test_array = (1,2,3,4,5,6);
foreach(@test_array) {
    print "$_" . "\n";
}

> under perl, version 5.005_03 built for alpha-linux
> (Redhat 2.2.14):
> 1
> 2
> 3

Weird.

This is what _I_ personally would expect  from the code
the OP mentioned, although I'm sure others may have other
ideas. Since it's undefined, it's moot (or as nobull said
in another response, non-sequiter):

1
3
5

 Here's my reasoning:

my @test_array = (1,2,3,4,5,6); ### sets up array
foreach (@test_array) {              ### performs an iteration
                                                  ### for each array member
    print shift(@test_array)."\n";    ### after each array member,
                                                  ### removes the next
member
}

So you see, if for every member you dealt with you removed the
next member, you'd get every other member printed.

> That means: in the first version, the array used by foreach was
> not changed by the shift call, and in the second version it was
> changed during the loop, so that it ended after half of the
> elements.
>
> Which one is right?
>
> Notes:
> 1) If "my" is omitted in the first line, the output is the same
> under
> both versions.

This is obviously a scope difference of some sort from using 'my'.
The problem isn't in the scope though, so I won't hurt my head
working that out.

> 2) In the case of the particular script I found this construct,
> it is not necessary and can be better written like this:
>
> my @test_array = (1,2,3,4,5,6);
> # or the same without "my"
> foreach (@test_array) {
>    print $_."\n";
> }

This would be preferred. See above. Of course, you could
change that print line to this instead:

print "$_\n"; ### or print "$foo\n";   depending

Chris S.









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

Date: 08 Sep 2000 01:00:34 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <slrn8rgefm.vlt.abigail@alexandra.foad.org>

Chris Stith (mischief@motion.net) wrote on MMDLXIV September MCMXCIII in
<URL:news:srg645noljn134@corp.supernews.com>:
== 
==  Here's my reasoning:
== 
== my @test_array = (1,2,3,4,5,6); ### sets up array
== foreach (@test_array) {              ### performs an iteration
==                                                   ### for each array member
==     print shift(@test_array)."\n";    ### after each array member,
==                                                   ### removes the next
== member
== }
== 
== So you see, if for every member you dealt with you removed the
== next member, you'd get every other member printed.

I don't understand. How could it print every other member? What would
happen with the 2 for instance? shift() shifts of the first element.
And since all elements that are shifted off are printed, how could you
ever print the third element, and not the second?

You don't remove the "next" member. You always remove the first one.
That's what shift does - shift isn't relative to $_.

Perhaps this will illustrate:

    my @test_array = (1 .. 6);
    foreach (@test_array) {
        print "$_ ", shift (@test_array), "\n";
    }
    __END__
    1 1
    3 2
    5 3


Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: Thu, 7 Sep 2000 17:22:27 -0700
From: "Kelley Kent" <kelley.a.kent@intel.com>
Subject: CGI & hashes
Message-Id: <8p9bdp$6n2@news.or.intel.com>

What would be the best way of sending (or more appropriately "maintaining")
a hash
array between CGI scripts. And without making a bunch of hidden variable
types.
Also, writing the data to a file and then re-redaing it over and over is not
a very
attractive solution.

Here's my situation: I do a lot data collection with system calls in a CGI
script,
display some info and then a series of forms get displayed to the user. But
I only
want to collect the data with system calls once, at their initial load of
the page,
and then use that information in the series of forms.

So is there an easy way to carry over the data? I tried (in vain) to add
some elements
to %ENV, as I thought it was persistant thru CGI scripts.

Any thoughts?

--Kelley




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

Date: Fri, 08 Sep 2000 00:01:51 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: CGI programming book
Message-Id: <slrn8rgbql.26k.tim@degree.ath.cx>

On Tue, 05 Sep 2000 08:44:55 GMT, Tim Hammerquist <tim@degree.ath.cx> wrote:
> unicef2k@my-deja.com <unicef2k@my-deja.com> wrote:
> > I recently landed a job as a web programmer.
> > Can someone recommend a CGI programming book? Or is there a site where
> > I can find reviews of that type of book.  I'll be using Perl.
> 
> Lemme get this straight: you got a CGI programming job _before_ you knew
> how to program CGI?  Are you admitting fraud?  =)
                                                ^^^^

-- 
-Tim Hammerquist <timmy@cpan.org>
Disclaimer: If anyone disagrees with anything I
say, I am quite prepared to not only retract it,
but also to deny under oath I ever said it.
	-- T. Lehrer


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

Date: Thu, 7 Sep 2000 15:16:34 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: confusing error msg
Message-Id: <MPG.1421b39ccdd670a698ad39@nntp.hpl.hp.com>

In article <jazztoneSPAMME-0709001637190001@tritone.csbmb.princeton.edu> 
on Thu, 07 Sep 2000 16:37:19 -0400, jazz <jazztoneSPAMME@earthlink.net> 
says...
> Hello, I get the following error message for the bit of code below. The
> portion of code that
> causes the error is marked with <<. When I remove that, no more error. I
> don't understand
> what the error is about, or why it's occuring at a nonexistent line 65535.
> Thanks.
> 
> ----
> 
> Value of <HANDLE> construct can be "0"; test with defined() at
> /usr/people/roger/bin/np1 line 65535.

This is a bogus warning introduced into Perl 5.004 and removed in Perl 
5.005.  The bogus line number is just a bug.

You can eliminate the wwarning by upgrading your perl, or by using the 
default read into $_:

    while (<PRESETS>) {

or by adding the defined() [ugh!]:

    while (defined($line = <PRESETS>)) {

> ----
> 
> #!/usr/sbin/perl -w

Good, but we would add here:

  use strict;

> ###   get presets
> print "Would you like to enter each value individually  (enter 'e') or use
> presets (enter the name of the preset file and return)?\n";
> 
> chomp($select = <STDIN>);
> 
> if ($select eq 'e') {
>     print "Enter the slice thickness.\n";
>     chomp($sliceThicknessOblique = <STDIN>);
> } else {
>     $cntr = 0;
>     while ($line  = <PRESETS>) {             <<
>        $line =~s/.*\t//;                     <<
>        chomp($line);                         <<
>        $presets[$cntr] = $line;              <<
>        $cntr ++;                             <<
>     }                                        <<
> }

To write in Perl instead of C, you could use push() instead of counting 
indexes.  Or you could replace the six-line explicit loop by a simple 
map().

      @presets = map /([^\t\n]*)$/ => <PRESETS>;
         
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 07 Sep 2000 22:39:10 GMT
From: abigail@foad.org (Abigail)
Subject: Re: confusing error msg
Message-Id: <slrn8rg66j.vlt.abigail@alexandra.foad.org>

jazz (jazztoneSPAMME@earthlink.net) wrote on MMDLXIV September MCMXCIII
in <URL:news:jazztoneSPAMME-0709001637190001@tritone.csbmb.princeton.edu>:
## Hello, I get the following error message for the bit of code below. The
## portion of code that
## causes the error is marked with <<. When I remove that, no more error. I
## don't understand
## what the error is about, or why it's occuring at a nonexistent line 65535.
## Thanks.
## 
## ----
## 
## Value of <HANDLE> construct can be "0"; test with defined() at
## /usr/people/roger/bin/np1 line 65535.
## 
## ----

You have an old version of Perl. The errorneous line number bug is fixed,
and nowadays there is an explicit defined() test around your assignment.

Without the defined(), you could have $/ set to 0 and exit your loop
too early if the file contains "00" - or with $/ set to \1, exit the
loop on encountering a 0.


Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
#    The Lone Merchant beside
#    a pond. A duck over
#    a dam. A beetle.


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

Date: Fri, 8 Sep 2000 10:38:23 +1000
From: "GEOFF" <lbg-goeff@powerup.com.au>
Subject: Re: Date Related Issue
Message-Id: <39b833a3@grissom>

Thanks All !!  I love this newsgroup :)




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

Date: Thu, 07 Sep 2000 16:31:51 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: Export data to an Excel spreadsheet?
Message-Id: <39B82567.8B8CB735@motorola.com>

Joe Edgar wrote:
> 
> I've got a program that displays a database in HTML.   My new "assignment"
> is to let a user select certain fields of the database and then export those
> fields to an excel spreadsheet.
> I've been trying to create a comma-separated-value (of the fields) with a
> ".csv" extension, but that doesn't seem to work.
> I need the program to open an Excel spreadsheet and import the data once the
> user clicks the submit button.
> Does any one have experience with this?
> 
> Thanks in advance..
> 
> --
> ----------------------------------
> Joseph Edgar
> Web Development Team
> Dir: (650) 604-0047
> NASA Ames Research Center
> Moffett Field, CA 94035

See (be careful with wrapped text):
http://www.activestate.com/Products/ActivePerl//docs/faq/Windows/ActivePerl-Winfaq12.html



-- 
/------------------------------------------------------------------\
| Matt Stoker                |     email: matt.stoker@motorola.com |
| Unit Process Modeling      | Mail Drop: M360                     |
| DigitalDNA(TM) Laboratories|     Phone: (480)655-3301            |
| Motorola, SPS              |       Fax: (480)655-5013            |
| 2200 W Broadway Road       |     Pager: (888)699-8803            |
| Mesa, AZ 85202             |                                     |
\------------------------------------------------------------------/


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

Date: Thu, 07 Sep 2000 15:32:01 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: golf: remove .txt from filenames
Message-Id: <39B81761.B3A541F@motorola.com>

Wyzelli wrote:
> 
> "Smylers" <Smylers-usenet@stripey.com> wrote in message
> news:2000Sep6.205334.27065@leeds.ac.uk...
> 
> > I thought maybe a nasty uncaptured Unix `mv` would help, but since the
> > glyph for that clashes with $`, it doesn't:
> >
> >   perl -e'map{`mv $\`$& $\``if/\.txt$/}<*>'
> >   perl -e'map{qx{mv $`$& $`}if/\.txt$/}<*>'
> 
> Definitely not on a Windows box (unless a unix toolkit is installed).
> The OP said Windows.
> 
> Wyzelli

Actually, I'm using HP-UX B.11.00. But, I'm working with files sent by a
friend on a windows box, hence the .txt problem. The use of ls, in the
original post should have tipped you off that Unix commands were Okay. 
Sorry for the confusion.
-- 
/------------------------------------------------------------------\
| Matt Stoker                |     email: matt.stoker@motorola.com |
| Unit Process Modeling      | Mail Drop: M360                     |
| DigitalDNA(TM) Laboratories|     Phone: (480)655-3301            |
| Motorola, SPS              |       Fax: (480)655-5013            |
| 2200 W Broadway Road       |     Pager: (888)699-8803            |
| Mesa, AZ 85202             |                                     |
\------------------------------------------------------------------/


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

Date: Thu, 07 Sep 2000 15:58:15 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: golf: remove .txt from filenames
Message-Id: <39B81D87.C9C69276@motorola.com>

Larry Rosler wrote:
> 
> In article <39B6B137.8E8A5E7B@motorola.com> on Wed, 06 Sep 2000 14:03:51
> -0700, Matthew Stoker <matt.stoker@motorola.com> says...
> > Matthew Stoker wrote:
> > >
> > > perl -e'/(.+)\.txt$/&&rename$_,$1for<*>'  - Larry Rosler (syntax error)
> 
> Nonsense.  Of course it was tested (on both Unix and Windows NT -- with
> double-quotes instead of single-quotes) and of course it works fine.

I tried to tell that to my Workstation, nevertheless cutting and pasting
the above onto a command line gives:

syntax error at -e line 1, near "$1for"
Execution of -e aborted due to compilation errors.

Could it be a version problem?
%perl -v
This is perl, version 5.004_04 built for PA-RISC1.1
(note: before everyone showers me with posts demanding I upgrade to the
latest version, I'm not the administrator for perl on this box and have
no control over which version is used.)

<snip>
> >
> > > ^^^^^^ These don't seem to work on my machine. (Maybe I'm doing something wrong)
> 
> Clearly.  (In addition to not wrapping your lines correctly. :-)

Have mercy on the newsreader impaired!

> 
> > Uri Guttman's correction to Abigail's entry does the trick:
> >
> >   ls|perl -lne'/\.txt$/&&rename$_,$`'
> >
> > is the current champion!
> 
> But wouldn't work where there was no 'ls' command, so flunks, IMO.
> 

As with real golf, scores are somewhat course dependent. On my course
(HP-UX B.11.00 with the c-shell) Uri/Abigail's entry is the winner.

-- 
/------------------------------------------------------------------\
| Matt Stoker                |     email: matt.stoker@motorola.com |
| Unit Process Modeling      | Mail Drop: M360                     |
| DigitalDNA(TM) Laboratories|     Phone: (480)655-3301            |
| Motorola, SPS              |       Fax: (480)655-5013            |
| 2200 W Broadway Road       |     Pager: (888)699-8803            |
| Mesa, AZ 85202             |                                     |
\------------------------------------------------------------------/


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

Date: Fri, 8 Sep 2000 08:57:28 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: golf: remove .txt from filenames
Message-Id: <2cWt5.3$8Z.2842@vic.nntp.telstra.net>

"Jim Cook" <jcook@strobedata.com> wrote in message
news:39B7B96F.2D60C732@strobedata.com...
>
> > The only one of those which is a legal filename under Windoze is
> > ".foo.txt".  The rest are not 'creatable' without extreme
contortions.
>
> Um, I typed "dir > ..txt" and "dir > ...txt" and they worked just
fine.
> Meaning, I got files names ..txt and ...txt. I'd hardly call that
> extreme contortions. "foo.txt\n" is harder.
>

For most windows users that is 'extreme contortions'!  "Command Shell?
What's that?".

What you might find is that in "Windows" you can't create those file
names (ie notepad-save as) because the . and .. refer to current and
parent directories.

In fact when you do as you did, what you get is a 'dos' filename of
"txt~1" linked to a 'windows long filename' of ".txt".

So yes, I would call that extreme contortions. :)

Wyzelli




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

Date: 08 Sep 2000 01:04:36 GMT
From: abigail@foad.org (Abigail)
Subject: Re: golf: remove .txt from filenames
Message-Id: <slrn8rgena.vlt.abigail@alexandra.foad.org>

Matthew Stoker (matt.stoker@motorola.com) wrote on MMDLXIV September
MCMXCIII in <URL:news:39B81D87.C9C69276@motorola.com>:
[] Larry Rosler wrote:
[] > 
[] > In article <39B6B137.8E8A5E7B@motorola.com> on Wed, 06 Sep 2000 14:03:51
[] > -0700, Matthew Stoker <matt.stoker@motorola.com> says...
[] > > Matthew Stoker wrote:
[] > > >
[] > > > perl -e'/(.+)\.txt$/&&rename$_,$1for<*>'  - Larry Rosler (syntax error)
[] > 
[] > Nonsense.  Of course it was tested (on both Unix and Windows NT -- with
[] > double-quotes instead of single-quotes) and of course it works fine.
[] 
[] I tried to tell that to my Workstation, nevertheless cutting and pasting
[] the above onto a command line gives:
[] 
[] syntax error at -e line 1, near "$1for"
[] Execution of -e aborted due to compilation errors.
[] 
[] Could it be a version problem?


No. "$1for" is wrong; there needs to be a space between $1 and for.



Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


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

Date: Thu, 07 Sep 2000 23:38:36 GMT
From: thedrag@--X--houston.rr.com
Subject: Re: how to restart apache
Message-Id: <39b82648.4642137@news-server.houston.rr.com>

Just make a small script named  
# !/bin/sh
#restart-apache.sh
/etc/rc.d/init.d/httpd restart
# end restart-apache.sh

ICK, I hope you aren't going to seriously use the apache rpm from the
RH distro.  
PLEASE DO NOT USE LINUXCONF to edit the apache config.   
1) The RH distro has an incomplete httpd.conf. some moron deleted the
majority of the documented config entries.
2) linuxconf will make some incorrect changes in your conf file


On Thu, 07 Sep 2000 16:46:11 GMT, Greg Donovan <sysnovice@my-deja.com>
wrote:

>In article <39B7B962.E97876EC@forestry.umn.edu>,
>  "Kirk R. Wythers" <kwythers@forestry.umn.edu> wrote:
>> Where does red hat put apachectl in a standard install? I know it's
>> installed but I can't seem to find and apache/sbin dir.
>>
>> Type in Whereis apache and you should get
>> $ /usr/lib/apache
>  To restart apache /etc/rc.d/init.d/httpd restart
>
>G.Donovan
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.



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

Date: 7 Sep 2000 20:02:23 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: memory leak with subroutine references
Message-Id: <8p9dqv$d0j$1@provolone.cs.utexas.edu>

In article <39B7A209.296A49C0@rz.hu-berlin.de>,
Oliver =?iso-8859-1?Q?Ebenh=F6h?=  <oliver.ebenhoeh@rz.hu-berlin.de> wrote:
>I wrote a perl subroutine that converts an object (details not so
>important) into a subroutine and returns a reference to it:

Well, the details *could* be important.  You might be able to use a
closure instead of using eval.  Or maybe not.  If you do, you'll avoid
the yuckiness of evaling a string when you don't have to.  You'll still
have an anonymous sub, but it'll come about in a different way.

If you need info about closures, do "perldoc -q closure".

  - Logan


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

Date: Thu, 7 Sep 2000 15:01:45 -0700
From: "Kelley Kent" <kelley.a.kent@intel.com>
Subject: Re: perl book?
Message-Id: <8p935u$pt@news.or.intel.com>

So can someone who's had both the 2nd and 3rd edition of Programming
Perl please tell me what the 400 additional pages are all about? What new
topics are discussed? In essence: the informational differences between
the two. And of course, if the upgrade is worth it or not.

-- Kelley




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

Date: Thu, 7 Sep 2000 15:08:03 -0700
From: "Kelley Kent" <kelley.a.kent@intel.com>
Subject: Re: perl book?
Message-Id: <8p93ho$18i@news.or.intel.com>

>> You left out learning perl. Deliberately, or accidentally?



Well, deliberately - but with no ill-will towards the book. I've never

used the book and I've had a couple coworkers who tried to learn perl

with it - and the only thing they ever did was continuously come to me

and ask questions for clarification purposes. I don't know if that means

the book is bad or if I just have dumb coworkers, but my exposure to

Learning Perl is very limited none the less. I just referenced the book

that I learned Perl from [Teach yourself Perl in 21 days]  since it did such

an excellent job. :)



Anyone use or teach themselves with Learning Perl? Did you have a

better experience than my coworkers?



-- Kelley







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

Date: 07 Sep 2000 22:19:58 GMT
From: Drew Simonis <care227@attglobal.net>
Subject: Re: perl book?
Message-Id: <39B81208.2953B9A0@attglobal.net>

Abigail wrote:
> 
>     Andrew Johnson: "Elements of Programming with Perl"

An excellent book indeed.

> 
> However, if you want to spend the money on just one book to make your
> Perl programming better, buy "Advanced Programming in the UNIX Environment"
> from Stevens.

I haven't read this text, but am always looking for things to make my 
hackish code more usefull.  I wonder, isn't this book more focused on
C programming, or does it cover technique more than sytax?


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

Date: 08 Sep 2000 00:01:55 GMT
From: abigail@foad.org (Abigail)
Subject: Re: perl book?
Message-Id: <slrn8rgb1p.vlt.abigail@alexandra.foad.org>

Drew Simonis (care227@attglobal.net) wrote on MMDLXIV September MCMXCIII
in <URL:news:39B81208.2953B9A0@attglobal.net>:
}} Abigail wrote:
}} 
}} > 
}} > However, if you want to spend the money on just one book to make your
}} > Perl programming better, buy "Advanced Programming in the UNIX Environment"
}} > from Stevens.
}} 
}} I haven't read this text, but am always looking for things to make my 
}} hackish code more usefull.  I wonder, isn't this book more focused on
}} C programming, or does it cover technique more than sytax?


No, it focusses on system functions and the C library (as opposed to the
C language). And Perl has _strong_ roots in the Unix/C API.

It, of course, doesn't mention Perl anywhere in the book.


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


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

Date: Fri, 08 Sep 2000 11:40:33 +1200
From: Ken <kenn_mar@hotmail.com>
Subject: Re: Regards CGI.pm
Message-Id: <39B82771.6C52B6D2@hotmail.com>




> You'll need to specify absolute paths for your images.  Your problem is
> that when you use the bare names, the browser interprets them as relative
> to your script's name.

I've done that but to no avail. Eg. I've tried "C:\\www\gifs\" in which case
CGI.pm prints out C:\www\gifs. I've tried "..\www\gifs\" and still didn't
worked. Any other alternatives?

-Ken




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

Date: Thu, 07 Sep 2000 22:55:34 GMT
From: "Chris Little" <clittle@mmcable.com>
Subject: return values from system() function
Message-Id: <G1Vt5.44235$d9.297720@typhoon.kc.rr.com>

I'm working on a script that requires the return value on fsck.  <32 is okay
==32 means its mounted >32 is a problem.

I tried

system($return_code = "fsck -m ",$filesystem);

but obviously that's not the answer, because it doesn't work.

Any help would be appreciated.




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

Date: 07 Sep 2000 18:03:27 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: return values from system() function
Message-Id: <87u2brx0sg.fsf@limey.hpcc.uh.edu>

>> On Thu, 07 Sep 2000 22:55:34 GMT,
>> "Chris Little" <clittle@mmcable.com> said:

> I'm working on a script that requires the return value
> on fsck.  <32 is okay ==32 means its mounted >32 is a
> problem.

> I tried

> system($return_code = "fsck -m ",$filesystem);

> but obviously that's not the answer, because it doesn't
> work.

$return_code = system ...;

But note how to parse the exit code in the perlfunc
documentation.

hth
t
-- 
WWNKD?


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4252
**************************************


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