[9582] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3176 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 16 13:07:24 1998

Date: Thu, 16 Jul 98 10:00:48 -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, 16 Jul 1998     Volume: 8 Number: 3176

Today's topics:
    Re: ***Can no one answer this question????*** abraham@mpi.com
    Re: Annoying warning : Variable %s will not stay shared (Greg Bacon)
        billing (fwd) <ol@twics.com>
    Re: Chomp() on win32 and unix perl <David.Boyce@fmr.com>
    Re: die() not calling exit() with ($?>>8) as perlfunc i <jdporter@min.net>
    Re: dynamically changing values in html from script.... (Steve Linberg)
        filehandles behaviour <gil_brown@hp.com>
    Re: Free email script setups?  Any clues ... <maierc@chesco.com>
    Re: HELP : Integrating an Access DB with Perl <perlguy@inlink.com>
    Re: How do I use perl for win95 in locally stored web p <jphipps@nanaimo.ark.com>
    Re: Indentation (Matthew H. Gerlach)
    Re: is IF statement BROKEN in 5.004? <quednauf@nortel.co.uk>
        Lex for Perl / Object Dumper? <swoboda@uvic.ca>
    Re: mail bomber source code for perl. <chris.wareham@blackwell.co.uk>
    Re: mail bomber source code for perl. <p-fein@uchicago.edu>
    Re: newbie date format <featheredfrog@geocities.com>
    Re: newbie date format (Larry Rosler)
    Re: newbie date format <Eric.Zylberstejn@wanadoo.com>
    Re: newbie date format <quednauf@nortel.co.uk>
    Re: newbie date format <quednauf@nortel.co.uk>
        Newbie write-to-file question <afox@u.washington.edu>
    Re: Perl Beautifier Home Page (Kenneth Herron)
    Re: Perl Beautifier Home Page (Larry Rosler)
    Re: Perl Beautifier Home Page <jdporter@min.net>
    Re: Perl for kids (Steve Linberg)
        perldb <shtil@netcom.com>
    Re: Please Help Me! (Matt's Script BB Problem) (Steve Linberg)
    Re: Please Help Me! (Matt's Script BB Problem) <jdporter@min.net>
        Problem writing an output file <amorri1@pop.sunalliance.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 16 Jul 1998 16:24:44 GMT
From: abraham@mpi.com
Subject: Re: ***Can no one answer this question????***
Message-Id: <6ol9gc$tim$1@nnrp1.dejanews.com>

In article <Pine.GSO.3.96.980715132052.38B-100000@armstrong.cs.Buffalo.EDU>,
  Bryan T Hoch <bth@cs.buffalo.edu> wrote:
> This posting was previously called:
> Re: Placing output from System() call into an array from the file that calls
it?
> and I've posted the question about 3 times in the last month and half.
> Can someone who knows the answer PLEASE let me know? Thanks!
>
> On Thu, 9 Jul 1998, Bryan T Hoch wrote:
>
> >
> > In one of my Perl programs, I have a line that calls a system call to see
> > who is on line.
> >
> >         if ((system ("rusers -l $hostA | fgrep $personA")) == 0){
> > 		}
> >
> > Basically it will check to see if $personA is on $hostA and if so, it will
> > place it in an array (somewhere in the if statement). At least that's what
> > I want it to do.
> > Right now, what it does is just spit out every single user on $hostA to
> > the screen (it doesn't take into account it's only looking for $personA.
> > How do I make it so it doesn't print it to the screen (rather to an array
> > or string in the program) and how do I do it so it only checks for
> > $personA, and not everyone on that host?
> > Thanks a lot to anyone who tries to help.
> > 							Bryan H

Backtick it: @onLine = `rusers -l $hostA | fgrep $personA`;

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 16 Jul 1998 15:04:30 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Annoying warning : Variable %s will not stay shared ...
Message-Id: <6ol4pu$3mq$1@info.uah.edu>

In article <35ADD656.18C77E6A@blackwell.co.uk>,
	Chris Wareham <chris.wareham@blackwell.co.uk> writes:
: I have some code that gives the following warnings:
: 
:   [tcw@sundog packaging]$ perl -c contentPackage 
:   Variable "$user" will not stay shared at lib/createManifest.pm line 118.
:   Variable "$passwd" will not stay shared at lib/createManifest.pm line 118.
:   contentPackage syntax OK
: 
: The perldiag.pod says that making block with the
: offending variables an anonymous sub should cure
: this. My block is defining a class that inherits
: from LWP::UserAgent, and can't be an anonymous
: sub ...
: 
: Is there any way of adapting my code to stop the
: warnings?

You can follow the wise instruction of perldiag. :-)

: Failing that, can I turn off warnings
: for a block?

That particular warning comes from the compiler after it compiles your
code and it's checking the syntax tree for possible errors, so you can't
turn it off without disabling all compile time warnings.  It's probably
better to just pacify the compiler.

Try this on for size:

    sub checkUrl {
         my ($url, $user, $passwd) = @_;

         require LWP;

         ## hush l'il compiler, don't you cry..
         my $junk = \&RequestAgent::get_basic_credentials;

         @RequestAgent::ISA = qw( LWP::UserAgent );
         *RequestAgent::get_basic_credentials = sub {
             ($user, $passwd);
         };

         my $ua = new RequestAgent;
         my $request = new HTTP::Request 'HEAD';

         $request->url($url);
         my $response = $ua->request($request);

         if($response->code != 200) {
             return(1);
         }
         else {
             return(0);
         }
    }

Notice that instead of declaring a sub, we're inserting our closure
into the symbol table.

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


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

Date: Fri, 17 Jul 1998 00:36:13 +0900
From: Kevin Baker <ol@twics.com>
Subject: billing (fwd)
Message-Id: <Pine.HPP.3.95.980717003221.29281E-100000@beehive.twics.com>

Hi, I posted this to comp.lang.perl.modules a couple of days ago but not
much response so here goes again.

I'm interested if anyone has written a billing system/module(s) in perl.
Or if anyone is interested in such a beast. I've been working on one for
about a year. It's been used but is still in an experimental stage. It's
definitly not ready for prime time and I'm looking for other developers to
assist or for brave people who want to hack through what is there now.

The basic design philosophy is to build a simple billing engine on free
software, something that is readily usable by a small business. I'm
interested in geting design input and feedback etc.

If anyone is interested in learning more please email me. 


Cheers

Kev






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

Date: Thu, 16 Jul 1998 15:17:36 GMT
From: David Boyce <David.Boyce@fmr.com>
Subject: Re: Chomp() on win32 and unix perl
Message-Id: <35AE19FE.EBBAB1C9@fmr.com>

Marc Haber wrote:
> 
> drummj@mail.mmc.org (Jeffrey R. Drumm) wrote:

> >I do sit at a Windows NT machine while editing my Perl scripts. However, I use
> >a reasonably decent X server on my system . . . Emacs, CPerl-mode, a bunch of
> >xterms . . . the only thing that could make me happier would no doubt incense
> >NT advocates. ;-)
> 
> Well, can you recommend a decent X server for WinNT that is free?

http://www.orl.co.uk/vnc/

-David Boyce


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

Date: Thu, 16 Jul 1998 15:44:56 GMT
From: John Porter <jdporter@min.net>
Subject: Re: die() not calling exit() with ($?>>8) as perlfunc implies?
Message-Id: <35AE2195.2A64@min.net>

eryq@zeegee.com wrote:
> 
>   #!/usr/bin/perl -w
>   # This should pass the exit status to the shell, but doesn't!";
>   open LS, "ls /no/such/dir |" or die "open: $!\n";
>   my @ls = <LS>;
>   close LS;
>   ($? >> 8) and die "ls failed: [$!][",($?>>8),"]\n";
> 
> It prints 0, even though Perl reports $?>>8 faithfully as 2, and $! is
> not set!  If I explicitly 'exit 2' from Perl I get what you'd
> expect... $? is set to 2 in the shell.

The $! is only telling you the result of the open(), which, if
you get past the "open or die", you know $! is OK.

To test the result of the ls, only use $?.  $! is not meaningful.
If you want to propagate the $? to your program's caller, use
an explicit die:

	$? >>= 8;
	if ( $? ) {
		print STDERR "ls failed.\n"; 
		# that's about as much as you can say, since we
		# don't have strerror.
		exit $?;
	}


-- 
John Porter

We have enough youth, how about a fountain of smart?


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

Date: Thu, 16 Jul 1998 12:43:57 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: dynamically changing values in html from script....
Message-Id: <linberg-1607981243570001@projdirc.literacy.upenn.edu>

In article <6o9797$rlk$1@bigdog.easynet.on.ca>,
visualsolutions@easynet.on.ca (Sue & Mike) wrote:

>   Hi,
> 
>     I am writing a script to control a form that accepts shipping
> information.  One of the requirements is that if the country is
> Canada, I display the provinces or if the country is USA, then display
> the states in the same spot.
> 
>    Can this be accomplished via a Perl cgi script or is this something
> I have to take care of using some client side java script????

Either approach is possible.  Perl/CGI gives you much more control.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 16 Jul 1998 12:09:58 -0400
From: "Gil Brown" <gil_brown@hp.com>
Subject: filehandles behaviour
Message-Id: <6ol8kt$4gf$1@ocean.cup.hp.com>

I have a script in which I was reading a file and printing the output on
STDOUT. I was doing :

my $line = <$fh>;
print "$line"; # To print the first line
while ($line ne "")
{
    print "$line";
    $line = <$fh>;
}

Now, thanks to Dave Barnett answering a posting I made earlier, I am now
using this (which works perfectly)

while (defined(my $line = <$fh>))
{
        print $line;
}

My question is in the first example , after I say my $line=<$fh> if I don't
follow with print "$line" I don't get the first line of the file but I get
everything else. Why??

Thanks




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

Date: Thu, 16 Jul 1998 15:30:30 GMT
From: Charles Maier <maierc@chesco.com>
Subject: Re: Free email script setups?  Any clues ...
Message-Id: <35AE1D8D.5229@chesco.com>

Tom Hicks wrote:
> 
> Hi,
> 
> Anyone have experience with any free email packages?  Found two at Matt's CGI script library
> http://www.cgi-resources.com/Programs_and_Scripts/Perl/Web_Based_E_Mail/
> 
> Both NetRoamer and or MailMan do not have any support and or way to purchase the scripts.  No way
> to contact them.
> 
> Anyone know of other scripts that do YAHOO type free email functions for web sites and have "some"
> support?
> 
> Thanks for your time.
> 
> Tom Hicks
> tomh@ncfweb.net
> InternetTemps  People with skills and those that need them.
> http://www.internettemps.com

"FREE with SUPPORT" doesn't sound compatible. How much is "some"?

I do do this programming to feed the meeeeces. They don't understand
free. You come around them with the phrase in your hand at the dinner
table and they will likely take it off to the elbow ;o)

What I am trying to say .. the scripts on Matts (and others)  are
without warrenty or guarentee or SUPPORT. They are that way BECAUSE they
are free. You want a guarentee??, 'some' support???  contract for it.


-- 
Chuck Maier
CDM Consulting Services
http://www.cdmcon.com
(610) 943-2726


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

Date: Thu, 16 Jul 1998 16:00:30 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: HELP : Integrating an Access DB with Perl
Message-Id: <35AE239E.BAA37598@inlink.com>

Well,

If you are on an NT system, which I am assuming you are since you want
to use Access, Dave Roth has an ODBC connectivity module that I have
been successfully using. 

I got it at http://www.roth.net/odbc but I just tried it and the link
was down for me.  It could have been our proxy server though, so I can't
way for sure if it will be down for you.

Once you get it installed and working, let me know and I can provide you
with some sample code.

Brent


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

Date: Thu, 16 Jul 1998 08:49:05 -0700
From: Jon Phipps <jphipps@nanaimo.ark.com>
Subject: Re: How do I use perl for win95 in locally stored web pages?
Message-Id: <35AE20F1.5112D7EB@nanaimo.ark.com>


--------------6393EF835D45EEBC42E2DFCB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



Chocolate wrote:

> I am trying to test my cgi scripts at home before I put them on the net.
> How do I do this?
>

Try this routine:

# first set your control flags

$localtest=1; # local testing
$dosrun=0;   # command line testing

# now vo the vars
$lsite="localhost";
$l_ip ="127.0.0.1";
$site2="www.nanhacks.net";
$site='http://www.nanhacks.net';
$admin="admin";
$mailto="\@www.nanhacks.net";
$dbpath="database";
$my_ip="1.35.0.4";

#now load 'm
if(($localtest eq 1) || ($dostest eq 1)){
        $ENV{'REMOTE_IP'}=$l_ip;
        $ENV{'REMOTE_HOST'}=$site2;
        $ENV{'REMOTE_USER'}=$username;
        $rhost=$ENV{'REMOTE_HOST'};
        $r_ip=$ENV{'REMOTE_IP'};
        $browser=$ENV{'HTTP_USER_AGENT'};
        $user=$ENV{'REMOTE_USER'};

i was having the same problem till i thought this one up

regards
    Jon Phipps


--------------6393EF835D45EEBC42E2DFCB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
&nbsp;

<P>Chocolate wrote:
<BLOCKQUOTE TYPE=CITE>I am trying to test my cgi scripts at home before
I put them on the net.
<BR>How do I do this?
<BR>&nbsp;</BLOCKQUOTE>
Try this routine:

<P># first set your control flags
<BR>&nbsp;
<BR>$localtest=1; # local testing
<BR>$dosrun=0;&nbsp;&nbsp; # command line testing

<P># now vo the vars
<BR>$lsite="localhost";
<BR>$l_ip ="127.0.0.1";
<BR>$site2="www.nanhacks.net";
<BR>$site='<A HREF="http://www.nanhacks.net">http://www.nanhacks.net</A>';
<BR>$admin="admin";
<BR>$mailto="\@www.nanhacks.net";
<BR>$dbpath="database";
<BR>$my_ip="1.35.0.4";

<P>#now load 'm
<BR>if(($localtest eq 1) || ($dostest eq 1)){
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ENV{'REMOTE_IP'}=$l_ip;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ENV{'REMOTE_HOST'}=$site2;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ENV{'REMOTE_USER'}=$username;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $rhost=$ENV{'REMOTE_HOST'};
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $r_ip=$ENV{'REMOTE_IP'};
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $browser=$ENV{'HTTP_USER_AGENT'};
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $user=$ENV{'REMOTE_USER'};

<P>i was having the same problem till i thought this one up

<P>regards
<BR>&nbsp;&nbsp;&nbsp; <A HREF="mailto:jphipps@nanaimo.ark.com">Jon Phipps</A>
<BR>&nbsp;</HTML>

--------------6393EF835D45EEBC42E2DFCB--



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

Date: Thu, 16 Jul 1998 16:01:50 GMT
From: gerlach@netcom.com (Matthew H. Gerlach)
Subject: Re: Indentation
Message-Id: <gerlachEw7372.MI8@netcom.com>

In article <6oiv52$iv@tekka.wwa.com> scribble@pobox.com writes:
>rra@stanford.edu writes:
>>Editors really should not insert tabs for anything.
>
>I'll take that as the crux of the whole matter. Consider
>me a convert.
>

I'm a convert too, but you better remember to turn tabs back on for
makefiles or you will have many, many problems.

Matthew



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

Date: Thu, 16 Jul 1998 15:53:57 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: is IF statement BROKEN in 5.004?
Message-Id: <35AE1405.E6B80306@nortel.co.uk>

Bill Catlan wrote:
> 
> Does anyone know why:
> 
> $a = 1;
> $b = 0;
> 
> if ($a > $b) {...}
> 
> evaluates false?

Not here...it's true

> 
> The following also evaluates as false:
> 
> $a = "1";
> $b = "0";
> 
> if ($a gt $b) {...}

This also doesn't happen...it's true

perl -v

This is perl, version 5.003 with EMBED
        built under hpux at Nov 21 1996 13:03:00
        + suidperl security patch

I am using 5.004 at home, and I've got that strange feeling that the
results there would be EXACTLY the same...

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Thu, 16 Jul 1998 08:19:30 -0700
From: Paul <swoboda@uvic.ca>
Subject: Lex for Perl / Object Dumper?
Message-Id: <35AE1A02.BA2DC09@uvic.ca>

Hi there,

Does anyone out there know if someone has hacked up
even an alpha version of a lex/flex that generates Perl
output (ie a yylex() routine, like "byacc -P" outputs a
yyparse() routine)?  I know there's a Parse::Lex module,
but it would be nice if I could just make an actual lex file;
my lex-spec is kind of (well... REALLY) ugly and I can't
really afford to generate a new lexer-object every time
the thing runs...  I was actually hoping to compile the
whole mess.

Barring the existence of a "flex -P", might there be some
easy way of generating the actual code for a yylex()
routine, from the object returned by Parse::Lex?  That
would be great, too.  Yah, does that exist in Perl?  A
dump-object routine?  I guess it wouldn't make much
sense for pre-compiled (XS) loadable objects, but it
might for the Perl ones...

Thanks in advance,

Paul
 .




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

Date: Thu, 16 Jul 1998 15:56:59 GMT
From: Chris Wareham <chris.wareham@blackwell.co.uk>
Subject: Re: mail bomber source code for perl.
Message-Id: <35AE2366.161679FD@blackwell.co.uk>

Matthew Flinchbaugh wrote:
> 
> hey does any one have the perl source code for a mail bomber?
> for Linux?
> 

Are you the same plonker that asked this question in comp.lang.c
a couple of days ago?

If so then you're going to get the same response here ...

Chris
-- 
chris.wareham@blackwell.co.uk
+44 (0)1865 792792 ext. 3381
http://www.killingmiranda.pair.com/


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

Date: Thu, 16 Jul 1998 16:04:25 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: mail bomber source code for perl.
Message-Id: <opg7m1dhjee.fsf@harper.uchicago.edu>

abigail@fnx.com (Abigail) writes:

> The computer is the game.

Cool quote.

-- 
Peter A Fein                                           Summering in SF!
Home: 650-571-6476                                   Work: 650-628-2172
p-fein@uchicago.edu                             pfein@us.checkpoint.com
Gilette's Razor: The best a man can get.


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

Date: Thu, 16 Jul 1998 11:08:36 -0400
From: "Michael D. Hofer" <featheredfrog@geocities.com>
Subject: Re: newbie date format
Message-Id: <35AE1774.7A1F@geocities.com>

Jan Lattunen wrote:
> 
> Hi there,
> 
> My problem is rather simple. I've been trying to get the
> date in a format like yyyy-mm-dd like 1998-07-16
> closest i've got so far is like 98-7-16.
> 
> Is there a simple way to do this straight, or do
> i have to use a module or something.
> 
> Thanks,
> Jan Lattunen, atropos@insomniac.keltti.jyu.fi

How about:

#!/bin/perl -w

use strict;

my ($yr,$mo,$dy)=(localtime())[5,4,3];
$yr+=1900;			#adjust for year 1900 - offset
$mo++;				#adjust for month zero-origin 
print join('-',($yr,$mo,$dy)),"\n";

-- 
Cian ua'Lochan /mka/ Michael D. Hofer
No Unsolicited Commercial Email: $500.00/Item for proofreading!
I'm not a medievalist - I just play one on weekends!
http://www.geocities.com/SoHo/Lofts/9800/


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

Date: Thu, 16 Jul 1998 08:18:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie date format
Message-Id: <MPG.1017b99d329a1d5798974d@nntp.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <35AE133E.193FC677@insomniac.keltti.jyu.fi> on Thu, 16 Jul 
1998 17:50:38 +0300, Jan Lattunen <atropos@insomniac.keltti.jyu.fi> 
says...
> Hi there,
> 
> My problem is rather simple. I've been trying to get the 
> date in a format like yyyy-mm-dd like 1998-07-16
> closest i've got so far is like 98-7-16.
> 
> Is there a simple way to do this straight, or do 
> i have to use a module or something.

You didn't say how you got the result you show, so I assume you did it 
with 'print'.  What you need to use is 'printf' (or 'sprintf' to a 
scalar) with the format '%.2d' which forces two (or more) digits in the 
output, with a leading zero if the value is less than 10.

<SOAPBOX ON>
You may also see that format as '%02d' which is not in the ANSI/ISO C 
Standard for [s]printf, because of the confusion factor with regard to 
the leading '0' that introduces an octal literal.  Consider '%08d' (which 
has to be jarring to the eye), or '%010d' (which is 10 digits, not 8).

The '%02d' form is documented and widely used in Perl, and will not go 
away (i.e., in terms of a recent thread, is not 'deprecated' in Perl).  
But is is not Standard C and is not esthetic Perl, IMNSHO.

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


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

Date: Thu, 16 Jul 1998 17:19:58 +0200
From: Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com>
Subject: Re: newbie date format
Message-Id: <35AE1A1E.A70C4373@wanadoo.com>

Hello,

Jan Lattunen wrote:
> My problem is rather simple. I've been trying to get the
> date in a format like yyyy-mm-dd like 1998-07-16
> closest i've got so far is like 98-7-16.


Use POSIX::strftime().

	Eric


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

Date: Thu, 16 Jul 1998 16:23:51 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: newbie date format
Message-Id: <35AE1B06.EFAB9E3B@nortel.co.uk>

Jan Lattunen wrote:

> My problem is rather simple. 

Hmmm...

> I've been trying to get the
> date in a format like yyyy-mm-dd like 1998-07-16
> closest i've got so far is like 98-7-16.

Darn close, innit ? :)

98 + 1900 = 1998 

See first grade maths books

printf("%.2d",7); # gives 07

See man printf

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Thu, 16 Jul 1998 16:34:51 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: newbie date format
Message-Id: <35AE1D9B.738DEE96@nortel.co.uk>

F.Quednau wrote:
> 
> See man printf
> 
Although I have to say that printf and its possibilities should be
covered in some part of the Perl documentation. Why ?
- 
I think quite a few Perl programmers don't have a C background (Would I
be the only one? Am I a programmer anyway?)
- 
It seems quite a few people program Perl on a Windows box (Including me,
but not for long anymore...Linux just came through the mail yesterday :)
-
man pages are scary for those not used to UNIX.

Is there a chance we will ever see printf documentation in Perl?
(Because, frankly, the Perl documentation is far beyond any man page
that I have seen so far in terms of comprehensiveness :)


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Thu, 16 Jul 1998 09:27:04 -0700
From: Aaron Fox <afox@u.washington.edu>
Subject: Newbie write-to-file question
Message-Id: <Pine.OSF.3.96b.980716091619.10004A-100000@saul3.u.washington.edu>

Greetings!

I've  got a newbie question for anyone who might be able to provide some
insight. I read the Perl FAQ about "how to change one line in a file", and
I'm pretty sure I understand the copy to a temp file/rename process.

What I have a question on is how to write the regular expression to get to
a specific location in the file. The file that I eventually want to write
to is a file generated by a program called PAW (it generates mesh files
and looks for connections between node elements...)

Further up in the script, I'm finding the node number and xyz coordinates
of nodes in another file that lie along a user-defined traceplane. I want
to then take the results and write them out to a pre-existing file. I'll
be pulling 3-5 character node numbers out of a pre-existing array
(@nodenumb)

I need to write to this position in the middle of the file (example
below):
 ------------------------------
5.000000e+000, 5.000000e+001	 !BC_time, Bval
2 	!n_output_nodes
277 1196 	<-----***need to add on to this list, tab deliminated only
20 	!n_output_times
1.000000e+005
2.000000e+005
-----------------------------

Here's what I've got so far: (sample code below):
-----------------------------------------
en (LTG_FILE, "<$ltg_file") or die "can't open old\n";  #equiv of $old
open (TEMP_FILE, ">$temp_file) or die "can't open new\n"; #equiv of $new

        while (<LTG_FILE>) {    #same as while (<OLD>)
	    next unless m/!n_output_nodes/i;
            (print TEMP_FILE $nodenumb[$i]) or die "can't write to $new: $!";

}

close (LTG_FILE) or die "can't close $ltg_file: $!";
close (TEMP_FILE) or die "can't close $temp_file: $!";

rename ($ltg_file, $bak) or die "can't rename $ltg_file to $bak: $!";
rename ($temp_file, $ltg_file) or die "can't rename $temp_file to $ltg_file: $!$
--------------------------end---------------------------

Thanks in advance for any help you can give. Reply to
<afox@u.washington.edu>

	      Aaron Fox: Geologist, Journalist, Web Designer
       afox@u.washington.edu || http://weber.u.washington.edu/~afox
	           PGP public key available on request



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

Date: 16 Jul 1998 15:37:52 GMT
From: kherron@campus.mci.net (Kenneth Herron)
Subject: Re: Perl Beautifier Home Page
Message-Id: <6ol6og$k89$1@news.campus.mci.net>

Just my two cents.  Back in college one of my CS teachers insisted that
the code we write for assignments be indented by standard tabstops AND
fit in 80 columns.  He said that if you found yourself crowding against
the right margin, it was time to split some of that code out into a
subroutine.  I tend to follow this advice, though not 100% (mostly
involving lines with long quoted strings in them).
-- 
Kenneth Herron -- kherron@campus.mci.net
"When Microsoft first took control of the Funk & Wagnalls Encyclopedia
product, there was a flattering biography of Bill Gates.  But it said he
was known as a tough competitor.  Now it says that he's known for his
charitable contributions." -- Gary Reback, <http://www.ljx.com/reback/>


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

Date: Thu, 16 Jul 1998 08:52:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl Beautifier Home Page
Message-Id: <MPG.1017c1a1ad784e2598974f@nntp.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <6ol6og$k89$1@news.campus.mci.net> on 16 Jul 1998 15:37:52 
GMT, Kenneth Herron <kherron@campus.mci.net> says...
> Just my two cents.  Back in college one of my CS teachers insisted that
> the code we write for assignments be indented by standard tabstops AND
> fit in 80 columns.  He said that if you found yourself crowding against
> the right margin, it was time to split some of that code out into a
> subroutine.  I tend to follow this advice, though not 100% (mostly
> involving lines with long quoted strings in them).

That's no excuse!  It is trivial to split long quoted strings over more 
than one line and unite the fragments by concatenation or by join('', 
 ...). 

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


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

Date: Thu, 16 Jul 1998 16:10:37 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35AE2799.5438@min.net>

Larry Rosler wrote:
> 
> That's no excuse!  It is trivial to split long quoted strings over more
> than one line and unite the fragments by concatenation or by join('',
> ...).

Oog.  You're adding executable code, just (nominally) for convenience
whilst editing?  Eeeiw.

-- 
John Porter

We have enough youth, how about a fountain of smart?


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

Date: Thu, 16 Jul 1998 12:37:53 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl for kids
Message-Id: <linberg-1607981237530001@projdirc.literacy.upenn.edu>

In article <6oj96b$f0b$1@vixen.cso.uiuc.edu>, jhayward@students.uiuc.edu
(jonathan seth hayward) wrote:

> I have two twin twelve year old brothers, whom I'd like to introduce to
> programming.

Well, this will probably rekindle the old "where to start?" debate.  I
think it's great to get kids into programming on the young side.  It is an
awful lot of fun.

My personal coding path, starting around age 10, went something like this:

BASIC (many flavors, including AppleSoft, TRS-80, Atari, and others),
forth, logo, 6502 assembly, C, Pascal.  Then lots of stuff I'd rather
forget, and finally, 3 or 4 years ago, I touched down in Perl.

I love Perl -- it *is* the game --, but I'm glad I didn't start with it. 
Plain vanilla C taught me more about programming than anything else,
because you can't write C without understanding memory, data types, and
data structures.  Once you know C, you can really appreciate everything
Perl does for you.  It certainly isn't the easiest place to start, though.

Perl could be an easy place to start in some respects, but it lets you be
loose in ways that most other languages don't.  So you may want to save it
for a bit.  Maybe start them in BASIC so they can quickly write programs
that do things; there has to be tons of material out there that would be
age-appropriate to your brothers.

Just one suggestion of many, of course!  Most important of all is to have
fun with it and build that hacker love. :)
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 16 Jul 1998 16:51:02 GMT
From: Yuri Shtil <shtil@netcom.com>
Subject: perldb
Message-Id: <shtilEw75H3.Cpn@netcom.com>

I am trying to run a perl script under the perldb emacs package.
I use Getopt::Std module to parse arguments. The problem is that perldb
does not like quoted strings, so -c "foo bar" does not become foo bar, but
"foo. I tried perl -d, and it works. I guess the shell does it's job,
but perldb does not.

ANy clues ?

		Yuri.




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

Date: Thu, 16 Jul 1998 12:25:00 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Please Help Me! (Matt's Script BB Problem)
Message-Id: <linberg-1607981225000001@projdirc.literacy.upenn.edu>

In article <6okb7r$lhh$1@nnrp1.dejanews.com>, Sniper308@qconline.com wrote:

> Nice?  I don't know how to PLEAD ON MY KNEES any nicer than to yell for help
> to someone who I think has the knowledge to help me.

Do you yell to your mother for help?  Do you yell to your friends for
help?  Do you yell to your boss for help?

Ordinarily, I'd just killfile you immediately, but your dizzying
cluelessness moves me to burn a few braincells on your behalf.  

Imagine you are a mechanic who loves the trade of working on and
maintaining automobiles.  You frequent an area where you hang out with
other mechanics, talking shop, looking at and tinkering with cars, reading
the trade mags, helping people from time to time who need assistance and
who ask nicely, and perhaps even occasionally asking a thoughtful question
of your own.

Someone barges in and "yells for help," and it goes something like this:

"My car doesn't work!  I need someone to fix it.  Well, it's not really
mine, some guy named Matt gave it to me for free, but he won't fix it for
me or answer my phone calls.  Yes, I do have lots of free manuals sitting
around that I could read to learn how to fix it myself, but I don't feel
like doing that.  Yes, I could take it to a garage to get it fixed, but I
don't want to pay anyone.  I want someone in here to fix it for me for
free.  I don't know what's wrong with it.  Here's the address of where
it's parked.  Oh yeah, it's locked.  Let me know what the problem is!"

See?

> Free?  I thought this was a newsgroup, not a contracting service system. 
> Yes, I expected "free" help.  If you people are "advertising," make it more
> obvious in your newsgroups title.

A few mechanics, annoyed by the expectant "fix it for me!" tone of this
obnoxious newbie, say "Sure I'll fix it.  Here's what it will cost you." 
The newbie flies into a huff and pouts that he thought everything here was
for free.

No, we're not advertising.  People help you if they feel like it.  How you
present yourself has a lot to do with that.

> I don't generally ask for help unless I've busted my gut trying to work
> things out on my own.  You and your snobby "I'll charge you $$$" friends can
> kiss my ass.

Ah, so your having "busted your gut" translates into an expectation that
others should now solve your problem for you?  You didn't bust it very
hard if you gave up that quickly.

> Problem description?  That's why I gave the URL, Einstein, so you could check
> it on your own.  I didn't think telling you "ERROR:  No Name" would have
> revealed any more to you, or anyone else, than a quick visit to the problem
> page.

"Here's where my car is parked; it's locked.  Go figure out what's wrong
with it, Einstein."  How are we supposed to see your source code from a
web page?  Unless you want one of us to crack your server/break into your
car.  Is that what you want?

Yes, with the "ERROR: No Name" message, I can tell you exactly what's
wrong.  It's obvious.  If you had been specific and polite about your
problem, I may have even told you what to do.  Perhaps someone else still
will.  With the way you presented yourself, my response is, either read
the documentation and figure it out for yourself, pay someone to fix it,
or write your own BBS.  And if you can't do that, then you are out of your
depth.

> I'm sure sorry I even came here for help.

So are the mechanics.

> Tell me, if you guys even go to church, do you put money IN the collection
> plate, or take it out?!!!

We put it in.  More than you can possibly imagine.

Now then:

*plonk*

Yell all you want.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 16 Jul 1998 16:25:17 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Please Help Me! (Matt's Script BB Problem)
Message-Id: <35AE2B09.1C72@min.net>

1. Contact Matt directly.  He wrote the crap; the onus is on him.

2. Read the helpful guide for solving Perl CGI problems:
    http://language.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html


Sniper308@qconline.com wrote:
> 
> Nice?  I don't know how to PLEAD ON MY KNEES any nicer than to yell for help
> to someone who I think has the knowledge to help me.

Hmm...  I don't think yelling is ever nice, regardless of bodily
posture.

-- 
John Porter

We have enough youth, how about a fountain of smart?


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

Date: Thu, 16 Jul 1998 17:35:51 +0100
From: "Alan Morris" <amorri1@pop.sunalliance.com>
Subject: Problem writing an output file
Message-Id: <6ol7n2$6mq1@extnews.sunalliance.com>

I'm having a problem writing to a file in a specific location and wondered
if anyone could help.

I have put a Perl script into the Scripts directory on an NT IIS and am able
to run it.

I would like to write to a file called output.txt in the _private directory
of a subweb I am using.

The statement

$output = ">>output.txt";

writes to the Scripts directory, and nothing I have tried allows me to write
the file anywhere else. I have tried using a URL and a full disk\directory
path and . and .. notation.

Also, I've tried adding

|| die "Error";

to the output file definition, but don't get anything back. Am I using die
incorrectly ?

Any help will be much appreciated - thanks !





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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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