[8791] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2408 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 24 01:07:33 1998

Date: Thu, 23 Apr 98 22:00:47 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 23 Apr 1998     Volume: 8 Number: 2408

Today's topics:
    Re: best way to find disk space for a directory <rjk@coos.dartmouth.edu>
    Re: Bill Gates should be invited to O'Reilly's "Free So <dfetter@shell4.ba.best.com>
    Re: BUG or FEATURE? -- splice() doesn't extend arrays (Abigail)
    Re: BUG or FEATURE? -- splice() doesn't extend arrays <rjk@coos.dartmouth.edu>
    Re: getting line numbers from file - grep -n (Martien Verbruggen)
    Re: Hash ref slice syntax? (Craig Berry)
    Re: Help w/ printing file contents to screen? (Martien Verbruggen)
    Re: Help with non-text output <rjk@coos.dartmouth.edu>
    Re: help with s/$foo/$bar/go; oddness <rjk@coos.dartmouth.edu>
    Re: linefeeds and perl formats <jcald@lake.ml.org>
    Re: matching man page lines <rjk@coos.dartmouth.edu>
    Re: PC-based editors for Perl? <kairys@mi.sl.com>
    Re: Perl for NT (Martien Verbruggen)
        PerlScript with PERL version 5.004??? <mccarthy@voicenet.com>
        PM-Only Modules and MakeMaker (John Siracusa)
        printing using the Format function (David)
    Re: Problem with Perl read on NT (Martien Verbruggen)
    Re: problem: num/str related (Martien Verbruggen)
    Re: Read-only value? (Wade Williams)
    Re: scalar assignment <rjk@coos.dartmouth.edu>
        Serial port quandry mhannam@gardner-webb.edu
        Setting $AUTOLOAD when calling SUPER::AUTOLOAD? <rrl@xnet.com>
    Re: split... (Martien Verbruggen)
    Re: split... (Mark-Jason Dominus)
    Re: spoiled noobie <tchrist@mox.perl.com>
    Re: sprintf documentation (was: Re: Question on: printf (Martien Verbruggen)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 24 Apr 1998 00:22:51 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: best way to find disk space for a directory
Message-Id: <354013A2.1AB907D6@coos.dartmouth.edu>

Alex Krohn wrote:
> 
> I need to find how much disk space is used within a directory. Two
> possible ways I can go are:
> 
> 1. do a `du -a -b $dir` and look at the last entry..

Not portable.  (du on my system doesn't have a -b option.)
BTW, the -a is unnecessary, since you're not using any info but the total size
of the directory.

> 2. use find to get a list of files and then loop through and stat each
> one to get the file size.

Painful.  Watch out for symbolic links.

> Which option is preferable? Is there a better way?

Beats me.

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


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

Date: 24 Apr 1998 03:17:55 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <6hp093$4dg$1@nntp1.ba.best.com>

In comp.os.linux.misc David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de> wrote:
> Zenin <zenin@archive.rhps.org> writes:

> > 	To this point, you are *highly* mistaken.  Have you ever even
> > 	installed FreeBSD?  I hear they've even had blind moneys do it
> > 	it's that simple, with simple duelbooting to anything else one
> > 	might like.

> duelbooting?  would that be starting both operating systems at the
> same time, let them run 10 paces, and then both try to shoot the
> other, and the survivor continues booting?

I keep imagining a musical piece called Dueling Bootsectors...

Not squealing,
Dave.
-- 
            David Fetter         888 O'Farrell Street Apt E1205
   shackle@ren.glaci.com          San Francisco, CA 94109-7089 USA
  http://www.best.com/~dfetter     +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)

"O tempura!  O morays!" -- Cicero, after dining on eels fried in batter.


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

Date: 24 Apr 1998 01:43:34 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: BUG or FEATURE? -- splice() doesn't extend arrays
Message-Id: <6hoqo6$8e$3@client2.news.psi.net>

Aaron Harsh (ajh@rtk.com) wrote on MDCXCVII September MCMXCIII in
<URL: news:6hom0v$pp1$1@brokaw.wa.com>:
++ Jason Gloudon wrote in message ...
++ >Tom Phoenix <rootbeer@teleport.com> wrote:
++ >>I'd like to see this fixed. The problem I see is that, if we were to fix
++ 
++ >>it now, it might cause some older program to break. :-P
++ 
++ 
++ It would cause some code I wrote last week to break:
++ 
++    @thingies = sort get_thingies();
++    @top_ten_thingies = @thingies;
++    splice @top_ten_thingies, 10;
++ 
++ If splice was "fixed" I might end up with undefs in my array (if there are
++ fewer than 10 thingies).
++ 
++ I suppose I could also have written it as:
++ 
++   @top_ten_things = @thingies > 10 ? @thingies[0..9] : @thingies;


Well, if @thingies is large, that would have saved you some needless
copying...



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Thu, 23 Apr 1998 23:43:19 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: BUG or FEATURE? -- splice() doesn't extend arrays
Message-Id: <35400A5C.B0E481B6@coos.dartmouth.edu>

Aaron Harsh wrote:
> 
> Jason Gloudon wrote in message ...
> >Tom Phoenix <rootbeer@teleport.com> wrote:
> >>I'd like to see this fixed. The problem I see is that, if we were to fix
> 
> >>it now, it might cause some older program to break. :-P
> 
> It would cause some code I wrote last week to break:
> 
>    @thingies = sort get_thingies();
>    @top_ten_thingies = @thingies;
>    splice @top_ten_thingies, 10;
> 
> If splice was "fixed" I might end up with undefs in my array (if there are
> fewer than 10 thingies).

Since you're not using splice() to add anything to the array, I don't think
that code would necessarily be affected by the bug.

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


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

Date: 24 Apr 1998 03:31:05 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: getting line numbers from file - grep -n
Message-Id: <6hp11p$jl2$1@comdyn.comdyn.com.au>

In article <353EDA27.1037@mail.netvision.net.il>,
	Elbit4 <elbit4@mail.netvision.net.il> writes:
> Hello
> I'm looking for a way to get the line numbers of lines that contain a 
> word I'm looking for in a file, something like what grep -n does in 
> shell. I don't want to go over the file line by line.

Then how do you propose to get the line numbers? You could of course
read in the whole file in an array, but then you still need to process
it line by line. You could read the whole file in in a scalar, but
you'd still need to go over it line by line.

At some point, something will have to process the whole file line by
line to get this information.

I really don't know how to do what you want, without iterating over
all the lines.

# grep -n Fri unison.log
412:DATE = Fri Apr 24 10:01:39 1998
417:DATE = Fri Apr 24 10:01:39 1998
421:DATE = Fri Apr 24 10:01:39 1998
425:DATE = Fri Apr 24 10:01:39 1998
429:DATE = Fri Apr 24 10:01:39 1998

# perl -e 'while (<>) {/Fri/ and print "$.:$_"}' unison.log
412:DATE = Fri Apr 24 10:01:39 1998
417:DATE = Fri Apr 24 10:01:39 1998
421:DATE = Fri Apr 24 10:01:39 1998
425:DATE = Fri Apr 24 10:01:39 1998
429:DATE = Fri Apr 24 10:01:39 1998

# perl -n -e '/Fri/ and print "$.:$_"' unison.log
412:DATE = Fri Apr 24 10:01:39 1998
417:DATE = Fri Apr 24 10:01:39 1998
421:DATE = Fri Apr 24 10:01:39 1998
425:DATE = Fri Apr 24 10:01:39 1998
429:DATE = Fri Apr 24 10:01:39 1998

This is 'somewhat' like grep -n. regexps are different, if you pass
multiple files, it will react differently, etc.. But you can use this
as a start.

Note that in both cases the file is processed line by line, once
through explicit use of while(<>), and once through the use of the -n
option.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 24 Apr 1998 04:04:04 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Hash ref slice syntax?
Message-Id: <6hp2vk$3tc$1@marina.cinenet.net>

Aaron Harsh (ajh@rtk.com) wrote:
: Craig Berry wrote in message <6hoico$gep$1@marina.cinenet.net>...
: >Suppose I have a hash reference:
: >
: >  $hr = { a => 1, b => 2, c => 3 };
: >
: >Now, suppose I want to obtain two of the values of this hash as a list
: >through a hash slice.
: 
: Either
:   @foo = @$hr{a, c};
: or
:   @foo = @{$hr}{a, c};
: 
: work for me.  Out of curiosity, what were you trying that didn't work?

Thanks to you and everyone else who answered this.  The weird part is that
I thought I'd tried that syntax, and that it hadn't worked, so I moved on
to more esoteric possibilites.  As I said in my original post, partial
brain lock.  Sigh. 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 24 Apr 1998 04:27:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help w/ printing file contents to screen?
Message-Id: <6hp4bv$jqf$1@comdyn.comdyn.com.au>

In article <6hmsai$uvj$1@news.netunlimited.net>,
	"David Joyce" <djoyce@netunlimited.net> writes:
> I can print to a file with <STDIN> pretty successfully, but how do I print
> file contents to screen in my scripts?  <STDOUT>?  If so, how?!?!

Errr. What sort of magical system are you on? STDIN is the standard
input, STDOUT the standard output. You normally read from STDIN, and
write to STDOUT. Maybe you should send us some code to show what you
tried, so we have a chance of understanding.

I really don't parse the line 'print to a file with <STDIN>
successfully' successfully.

Maybe I should try my crystal ball: Do you mean that you know how to
read from STDIN (using the <STDIN> construct), but you don't know how
to _print_ to STDOUT?

while(<STDIN>)
{
	print STDOUT $_;
}

Recommended literature:

The second edition of 'Programming Perl', see http://language.perl.com/info/documentation.html

# perldoc perl
# perldoc perlop
# perldoc perlsyn
# perldoc perldata
# perldoc perlfunc
# perldoc -f print

Martien

PS. homework: What do you think 

	print STDOUT <STDIN>;

does?
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 23 Apr 1998 23:45:22 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Help with non-text output
Message-Id: <35400AD7.AA7ADEB7@coos.dartmouth.edu>

Trupiano wrote:
> 
> I assume this has something to do with how I <print> it, but
> I cannot figure what this might be?

Well, since you haven't told us how you print it, neither can we.

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


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

Date: Fri, 24 Apr 1998 00:18:42 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: help with s/$foo/$bar/go; oddness
Message-Id: <354012A9.CA2656C7@coos.dartmouth.edu>

Martien Verbruggen wrote:
> 
> So, the regexp /|/ matches nothing or nothing, which is nothing. Which
> is exactly equal to //.

Except for the magic of a null pattern, as in //, of course.  :-)

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


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

Date: Thu, 23 Apr 1998 20:11:32 -0700
From: John Caldwell <jcald@lake.ml.org>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: linefeeds and perl formats
Message-Id: <Pine.LNX.3.96.980423200642.3669B-100000@dollar>



On Thu, 23 Apr 1998, Tom Phoenix wrote:

> On Thu, 23 Apr 1998 jcald@lake.ml.org wrote:
> 
> > I'm trying to use perl's 'format' to output some text in some columns. 
> > My problem is that some of the strings are like "foo\nbar\nbaz\n"
> 
> You may want the @* format. Hope this helps!
> 

This wont work, as i want all the text indented evenly (which you should
see by my first format.) Basically this is what i get:


Stuff:        foo
bar
baz



But what i'm really looking for is this:

Stuff:        foo
              bar
              baz




Anyone have any other ideas?





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

Date: Thu, 23 Apr 1998 22:57:45 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: matching man page lines
Message-Id: <353FFFAB.E28FDEC1@coos.dartmouth.edu>

John Erjavec V wrote:
> 
>         next if (/^\s+(.+).+(\1)\s*$/); #for all headers

This is probably the slowest regex.  It seems like it would take a lot of work
to try all the possibilities with non-matching lines, and since you're
matching headers and footers I bet most of the lines don't match.

This should speed it up a little without changing the set of matching strings:

/^\s+(\S.*).+(\1)\s*$/

Anyway, that regex will match lines like

"   foo does weird things if\n"

Are you sure that's what you want?

> if ($#ARGV == 1) {
>         if (($ARGV[1] eq "4up") || ($ARGV[1] eq "2up") || ($ARGV[1] eq "2+")) {
>                 @system_args = ("lp", "-t$manpage", "-o$ARGV[1]", "$temp_file");
>         }
> } else {
>         @system_args = ("lp", "-t$manpage", "$temp_file");
> }
> 
> system @system_args;

What should @system_args be if $#ARGV is 1 and $ARGV[1] is none of those strings?

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


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

Date: Thu, 23 Apr 1998 22:39:01 -0400
From: "Michael Kairys" <kairys@mi.sl.com>
Subject: Re: PC-based editors for Perl?
Message-Id: <35400789.0@news.ic.net>


>PFE32 has been the most flexible PC-based editor that I've yet to run
>across. PFE is short for Programmers File Editor.  It's freeware, does
>Keyboard Macros, Auto-indent, pretty printing, handles unix <> dos files,
>etc. The only thing on my wish list for it is column-selection, something
>I'm not missing in my fave x-windows editor, 'nedit'.


I used PFE for three years but I've switched to GTE (GWD Text Editor)..
It has almost everything PFE has (except mode groups) and a lot more,
including syntax coloring, a very flexible macro and tool menu customizer,
customizable toolbar, column selection, sorting, bookmarks, expand/compress
tabs, write select region to file (I like that one!), spell checker,
customizable file
filters, etc. etc.

It has syntax coloring for a wide variety of languages including Perl, csh,
MS-DOS
BAT, Windows INI, Installshield, as well as C, Pascal, Basic, ...

http://www.iridis.com/gwd/ shareware, registration is $20.






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

Date: 24 Apr 1998 02:51:41 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl for NT
Message-Id: <6hount$jg9$1@comdyn.comdyn.com.au>

In article <DA3543C230294159.49E2F5504DFB666E.55C453FC96322B9B@library-proxy.airnews.net>,
	"Nathan Stanford" <nathan@cyberservices.com> writes:
> Does Tom Phoenix have to put down everyone when they ask a question.  This

Tom Phoenix does what? Are there a bunch of threads going on that I
don't know about? Is Tom posting invisibly to me, and dejanews?

I certainly haven't seen Tom Phoenix do anything like that.

And in this specific case: He answered the question, by pointing to
the excellent documentation that is already around. 

> is a Perl Misc and Perl is a leading CGI Scripting Lang.  Since the person

So? Even if ALL the CGI programmers chose perl as their language, that
still didn't mean that perl has anything to do with CGI or the other
way around. Just like C has nothing at all to do with Xwindows, or
even MS Windows.

I've been programming in perl for.. who knows, since somewhere in 91.
CGI didn't come along until about 93 or 94 and didn't become anything
important until about 96.  I do not use perl at all for CGI stuff, but
do most of that in C or C++, depending on the task.

Summary:

comp.lang.perl.misc is not for the discussion of CGI, even though you
can use it to implement CGI scripts
comp.lang.perl.misc is not for the discussion of Internet Mail, even
though you can use it to implement mail clients, and even servers.
comp.lang.perl.misc is not for the discussion of HTML, even though you
can get it to print HTML
comp.lang.perl.misc is not for the discussion of Operating Systems,
even though it runs on several.
comp.lang.perl.misc is not for the discussion of cucumbers, even
though you can use it to write a program that monitors your
greenhouse, and waters your plants.

comp.lang.perl.misc is for the discussion of perl.

Simple, eh?

> is wanting to know about Perl for NT vs Perl for Unix, he seems be in the
> right place.   This is Perl (hmmm)  and misc (Misc hmm)

The .misc at the end does not allow you to disregard the comp, .lang
and espially the .perl that come before it. This group is for the
discussion of miscellaneous issues of perl. Not miscellaneous issues
in general. That includes everything.

> One of the many differences beside the programs that do not work on the NT
> like sendmail unless you install a seperate app. is the way Directories are
> pointed to the path...

Actually, that is not really a difference between unices and dos/nt.
Both kernel level functions understand the /. It's just the command
interpreters, or shells on dos/nt that don't.

Of course, if you want to be portable to ALL platforms, you should
follow Tom Phoenix's advice.

Martien

PS. I can only classify your post as a troll. And I fell for it. dang.
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Fri, 24 Apr 1998 04:30:25 GMT
From: Michael McCarthy <mccarthy@voicenet.com>
Subject: PerlScript with PERL version 5.004???
Message-Id: <35403F2F.E9FCC4EF@voicenet.com>

I have just installed the port of PERL version 5.004 built by Gurusamy
Sarathy. Everything is working fine, but now I can't get ActiveState's
PerlScript (Build 316) working with this version of PERL.

Is this an impossiblilty? When I go to install PerlScript, the install
tells me it can't find the perl interpreter.... that's a crock, the
interpreter is there, just not ActiveState's interpreter.

Any help or pointers would be greatly appreciated.

Mike

--
Michael McCarthy
Senior Programmer
Frontier Media Group
mmccarthy@fmgnet.com
home: mccarthy@voicenet.com




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

Date: 24 Apr 1998 03:53:25 GMT
From: macintsh@cs.bu.edu (John Siracusa)
Subject: PM-Only Modules and MakeMaker
Message-Id: <6hp2bl$r9s$1@news1.bu.edu>

I'm in the process of making a Perl module that consists of a bunch
of .pm files, and a few pods.  I'd like to be neat and spiffy like
the "real" module authors and give users a quick way to install my
module.  You know the drill:

	perl Makefile.PL
	make
	make test
	make install

The problem I keep running into is that MakeMaker insists on
spewing a lot a junk I don't seem to need: "blib" stuff, "auto"
stuff, etc.  All that really needs to be done to "install" the
module is a simple copy of the module directory to the user's
site_perl directory.  But a plain "cp" doesn't seem to be the Right
Thing to Do (you don't get the neat logging of installed modules,
the manifest check, etc., etc.)

I tried changing every MakeMaker setting I could think of, but I
still get a mess of unneeded directories.  Worse, the .pm files
often don't get copied or installed *anywhere*!  I've been trying
to do all this with PREFIX set to my home dir so I don't screw up
the "site" perl setup with my mistakes, so that could be part of my
problem.  Heck, to even get "make install" to run with PREFIX set,
I have to create the arch dirs myself before running make--hardly a
one-step process for users.

MakeMaker *is* in ExtUtils::, after all, and I'm not exactly
creating a new perl binary or even installing compiled binary libs
(although I get a "blib" dir just the same).  But it certainly seems
like there must be some portable way to get my simple .pm and .pod
files installed in the appropriate directories with one or two
commands.  Where have I gone wrong?

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow



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

Date: Fri, 24 Apr 1998 04:02:39 GMT
From: davidu@electriciti.com (David)
Subject: printing using the Format function
Message-Id: <35400c04.44508146@news.electriciti.com>

I was wondering how I can print information returned from a form/CGI
and print to a file through a form.  I want it to appear like this in
the file. please emial the response to me. 
<a href-"davidu@eciti.com>davidu@electriciti.com</a>
thank you,
David Ulevitch
p.s. How can I read from this file, and keep the scalers. By using:
($idnum,$title,$author,$body) = split (/:/); ?


I have defined a format:

format DATATABLE =
-----                
@<<<<<: 
$idnum
<B>@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:</B>
$title
<I>@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:</I>
$author
<BR><P>@*:
$body
 .


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

Date: 24 Apr 1998 02:54:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Problem with Perl read on NT
Message-Id: <6houtp$jg9$2@comdyn.comdyn.com.au>

In article <6hml62$bqt@bgtnsc02.worldnet.att.net>,
	"Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print> writes:
> 
> Martien Verbruggen wrote in message
> <6hmgfn$bo1$1@comdyn.comdyn.com.au>...

[not this]

>>> If not, is it just the first line such as '#!/usr/bin/perl' - what
>>> would you change this to hypothetically if the NT Perl interpreter
>>> was in directory '\bin\test' ?

[but this :)]

>>NT doesn't care about this first line. Unix shells do.
> 
> 95% true. NT cares about any Perl switches that normally go on the
> shebang line (e.g. #!/usr/bin/perl -w) but as for the location of the
> Perl executable, yes, it gets that from the PATH environment variable.

Actually, NT, or rather, the command shell that ships with NT, doesn't
care about that line. Perl, however, will inspect that line itself.
So, the flags will be in effect, even though the path, and the #! are
meaningless. But it's a perl thingie, not NT :)

> Hmm, maybe I'll try
> 
> #!/this/is/a/program/written/in/perl -w

Should work without warning, but I haven't tried it :)

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 24 Apr 1998 02:28:46 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: problem: num/str related
Message-Id: <6hotcu$j8f$3@comdyn.comdyn.com.au>

In article <6hnb84$cj8$1@nntp2.ba.best.com>,
	"Xah" <xah@love.com> writes:

> #!/usr/local/bin/perl

Why no -w?

> use strict;
> 
> sub verifyArgument {
>     my($d1,$d2)= @_;
> 
>     print "$d1, $d2, \n";
> 
>     if (undef($d1) or undef($d2)) {return "start date or end date are not
> given.\

You really should format your code a bit nicer :)

Ok, lets see what the documentation has to say about undef:

# perldoc -f undef
=item undef EXPR

=item undef

Undefines the value of EXPR, which must be an lvalue.
[snip]
Always returns the undefined value.

Hmmm.. That doesn't look right. You wanted to test if the values were
defined, right? Maybe you should use defined:

# perldoc -f defined
=item defined EXPR

=item defined

Returns a Boolean value telling whether EXPR has a value other than
the undefined value C<undef>.

That looks better.

if ( !defined($d1) || !defined($d2) )
{
	return "Something meaningful";
}

Which can also be written as:

return "Garbage input" unless ( defined($d1) && defined($d2) );

which, depending on your taste, might be easier to grok.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 23 Apr 1998 22:22:37 -0500
From: wwilliam@cisco.com (Wade Williams)
Subject: Re: Read-only value?
Message-Id: <wwilliam-2304982222370001@10.0.0.2>

In article <slrn6jus2s.ail.jgloudon@hyssop.bbn.com>, jgloudon@bbn.com wrote:

>Wade Williams <wwilliam@cisco.com> wrote:
>.
>>foreach $val (@{$v->{ord}},@{$v->{ordpoints}})
>.
>
>When you write this, Perl 'flattens' your two arrays into a single anonymous 
>array out of your two arrays, so $_ is no longer a reference to the elements
>of your arrays.

Hmm..I'm confused then.

The following code works:

            foreach $val (@firedrow,@dmgrow,@hitrow,@tdamage)
            {
               if (! $val)
               {
                  $val="&nbsp";
               }
            }

So, Perl takes my 4 arrays and flattens them into one big anonymous
array.  That array must contain references to the elements of the 4
original arrays, because when I display those arrays later, undefined
elements have indeed been changed to "&nbsp".

So, it would seem to me that the same thing would occur with the first
example.  Other than needing a little more complex dereferencing, what's
the difference in the two?

Thanks,

Wade

-- 
 --------------------------------------------------------------------------
 Wade Williams                      Fly WarBirds! (Mac or PC)
 Systems Engineer, CCIE #3373          http://www.icigames.com/warbirds
 Cisco Systems, Inc.                        
 Brentwood, TN                      
 615-221-2918                              
 wwilliam@cisco.com    
 --------------------------------------------------------------------------


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

Date: Thu, 23 Apr 1998 23:57:34 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: scalar assignment
Message-Id: <35400DB4.4AC9D202@coos.dartmouth.edu>

tw96 wrote:
> 
> i tried, but still don't know how to correct these two errors, please
> help!!!

Looks like you tried to correct the error messages, instead...

> error1 on one program:
> line 3: syntax error near unexpected token

That is not a valid Perl error message.  What were the actual error messages
you got?

> `open(FILE,"</client/home/webcmo/docs/report.html")'

You may be missing a semicolon on that line.

> line 3:
> `open(FILE,"</client/home/webcmo/docs/report.html")||&return_error(500,"Serv
> er Error","Can not open report file!");'

How many line 3s do you have in this script?

> error2 on another program:
> Can't modify not in scalar assignment at line 3, near
> "$base = "/client/home/webcmo/docs/";"

Well, it's near that code...  So, what other code is near, specifically
before, that line?

> it's strange because i used these two sentences in other similar programs,
> they did not show such errors.

Show me the preceeding lines, and I'll show you why you're getting these errors.

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


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

Date: Thu, 23 Apr 1998 22:36:06 -0600
From: mhannam@gardner-webb.edu
Subject: Serial port quandry
Message-Id: <6hp1bd$odn$1@nnrp1.dejanews.com>

Hi.  For my final exam in a networking class, I'm trying to toggle an LED
light from a remote computer via the internet.  I've got the LED running on
the 5 volts from my serial port on pins 15 and 10.  Can I use Perl to turn the
port on/off and in doing so turn th LED on/off?  Thanks for any help you can
offer.  Matt

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 23 Apr 1998 23:39:59 -0500
From: Robert Lang <rrl@xnet.com>
Subject: Setting $AUTOLOAD when calling SUPER::AUTOLOAD?
Message-Id: <3540179F.678CCC24@xnet.com>

Howdy.

I'm overriding the AUTOLOAD method in a subclass, poking at the
$AUTOLOAD variable and setting an ivar depending on a test.  I'd then
like to call SUPER::AUTOLOAD, but the $AUTOLOAD package global isn't set
when it gets there.

Essentially, I'm trying this:
return $self->SUPER::AUTOLOAD(@_);

Since that's not working, I created my own package global, then did a
$name = $AUTOLOAD || $global_var;

I feel sleezy.  :-)

I gotta call SUPER, but there's got to be a prettier way.

Any help is greatly appreciated.

Robert Lang
rrl@xnet.com




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

Date: 24 Apr 1998 02:21:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: split...
Message-Id: <6hosvt$j8f$2@comdyn.comdyn.com.au>

In article <6hokp7$v2b$1@nnrp1.dejanews.com>,
	jcoffey@connectnet.com writes:

> open (DUMB_FILE, "dumb.file");

You should check the return value of open()

> while (<DUMB_FILE>) {
> 	(????????) = split /,/, $_;
> }
> 
> what the hell do I put in for "???????"  Is there anything built in to perl

Let's see what the documentation has to say about this:

# perldoc -f split
=item split /PATTERN/,EXPR,LIMIT

=item split /PATTERN/,EXPR

=item split /PATTERN/

=item split

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

(AHA, it returns an array of strings)

Now.. what is an array, or list, in perl?

# perldoc perldata
[snip]
but entire arrays or array slices are denoted by '@', which
works much like the word "these" or "those":
@days               # ($days[0], $days[1],... $days[n])
[snip]

Hmm... Maybe

@stuff = split /,/

will work?

I'll leave that up to you to test.

Martien

PS. Please read the documentation I referred to. It's very informative.
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 24 Apr 1998 00:34:22 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: split...
Message-Id: <6hp4oe$nt4$1@monet.op.net>
Keywords: cutset Norton over woody


In article <6hokp7$v2b$1@nnrp1.dejanews.com>,  <jcoffey@connectnet.com> wrote:
>($blah1, $blah2, $blah3, $blah4) = split /,/, $_;
>
>fine, BUT what if this is in a while loop and the lines have varying numbers
>of blah?

	@blahs = split /,/, $_;

Now the blahs are in $blah[0], $blah[1], ...

The number of the last blah is $#blahs, so the total number of blahs
is   1 + $#blahs.

For example:

	print "There were ", 1 + $#blahs, " in all.\n";
	print "The last blah was $blahs[$#blahs]\n";

	foreach $blah (@blahs) {
	  print "Another blah:  $blah\n";
	}



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

Date: 24 Apr 1998 03:45:14 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: spoiled noobie
Message-Id: <6hp1sa$r4u$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, rjk@coos.dartmouth.edu writes:
:I wish I knew why you quoted Larry's suggestion entirely out of context in
:order to flame him for ignoring the FAQ.

Because I read too shortly!

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
In general, if you think something isn't in Perl, try it out, because it
usually is.  :-)
        --Larry Wall in <1991Jul31.174523.9447@netlabs.com>


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

Date: 24 Apr 1998 03:13:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: sprintf documentation (was: Re: Question on: printf %o STDOUT)
Message-Id: <6hp016$ji6$1@comdyn.comdyn.com.au>

In article <353EFB81.1380@linguistik.uni-erlangen.de>,
	Christian Wetzel <cnwetzel@linguistik.uni-erlangen.de> writes:

> Ah by the way, why is the CPAN HTML Version of perlfunc/sprintf
> <URL:http://language.perl.com/CPAN/doc/manual/html/pod/perlfunc/sprintf.html>
> missing the explanation of the conversions (%c, %s etc.)?
> (perldoc -f sprintf is complete instead.)
> 
> Are the CPAN docs older than 5.004_04? 

Yes. They're 5.004-beta1 docs.

http://www.perl.com/CPAN/doc/manual/html/index.html

> Why?

I don't know. Maybe nobody got around to putting a newer set of
documentation there.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

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

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