[9360] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2955 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 24 00:08:50 1998

Date: Tue, 23 Jun 98 21:00:27 -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           Tue, 23 Jun 1998     Volume: 8 Number: 2955

Today's topics:
    Re: Copying an Anonymous Hash <mpersico@erols.com>
    Re: first language (Cameron Foster)
    Re: Flames.... <looie+gnus@teleport.com>
    Re: Have we got a good free Perl manual? <mpersico@erols.com>
    Re: Have we got a good free Perl manual? <tchrist@mox.perl.com>
    Re: Have we got a good free Perl manual? (Chris Nandor)
        How make a variable name from a datafile? (Thomas Munn)
    Re: How make a variable name from a datafile? <tchrist@mox.perl.com>
    Re: How make a variable name from a datafile? (Martien Verbruggen)
    Re: how to write CGI scripts to connect form in HTML to <joseg@nousit.net>
        I need letters in support of a nomination for Larry (Gene Spafford)
    Re: learning Perl? <mpersico@erols.com>
    Re: moving perl -ne into a file? (Martien Verbruggen)
        Parsing <tags> <melkor@Cal040031.student.utwente.nl>
    Re: Parsing <tags> <tchrist@mox.perl.com>
    Re: Perl standard distribution and IIS 4 (Paul Tjapkes)
    Re: printf in assignments <stuartc@ind.tansu.com.au>
        Problem compiling in Linux <kingram@sdl.org>
        Regex dilemma <dm@ho.com>
    Re: Storing and passing object references - html crap <mpersico@erols.com>
    Re: string substitution (Martien Verbruggen)
    Re: system() and security again <*@qz.to>
    Re: Testing perl knowledge (Chris Nandor)
    Re: Testing perl knowledge (John Stanley)
    Re: Windows95, Perl-32 and Personal Web Server (PWS) (nobody)
    Re: Would someone tell me what this means? (Martien Verbruggen)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 23 Jun 1998 23:47:12 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Copying an Anonymous Hash
Message-Id: <359076C0.A20FFC1A@erols.com>

Oh come now, can't anyone run perl -d -e42 these days? There aren't that
many permutations. You have an anon hash on the right. You can either
take the ref to it or the hash itself. You can assign it to a hash or a
ref. That's a two by two permutaion of four possibilities by my
reckoning. Here they are:

  ## Create an anon and ref it
  DB<15> $hash = {hello => 1, goodbye =>2};  
  ## Assign to each of four possibilities:
  DB<16> $h1 = $hash;
  DB<17> $h2 = %{$hash};
  ## Guess this one is out of the question!
  DB<18> %h3 = $hash;
Odd number of elements in hash list at (eval 37) line 2, <IN> chunk 18.
        eval '($@, $!, $,, $/, $\\, $^W) = @saved;package main; $^D =
$^D | $DB::db_stop;
%h3 = $hash;;

;' called at C:\Program Files\Perl\lib/perl5db.pl line 929
        DB::eval called at C:\Program Files\Perl\lib/perl5db.pl line 851
        DB::DB called at -e line 1

  DB<19> %h4 = %{$hash};
  ## Print 'em
  DB<22> x $hash
0  HASH(0x1007c28)
   'goodbye' => 2
   'hello' => 1

  ## Another reference to the SAME hash (as evidencd by the fact that
the stuff in parens is the same.
  DB<23> x $h1
0  HASH(0x1007c28)
   'goodbye' => 2
   'hello' => 1

  ## Assiging the hash %{$hash}, not the ref, to a scalar gives
distribution info  
  DB<24> x $h2
0  '2/8'

  ## Not useful for this question
  DB<26> x %h4
0  'goodbye'
1  2
2  'hello'
3  1

  ## This is a trick I learned from one of Randal's books to make the
hash output look nicer and get at
  ## the "address" info. Now we an see assigning a hash to another hash
makes a copy.
  DB<27> x \%h4
0  HASH(0x10008a4)
   'goodbye' => 2
   'hello' => 1


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

Date: Wed, 24 Jun 1998 03:20:46 GMT
From: cdfoster@ix.nospam.netcom.com (Cameron Foster)
Subject: Re: first language
Message-Id: <358f24c5.17140653@nntp.ix.netcom.com>

On Mon, 22 Jun 1998 22:37:00 GMT, paulb@user1.teleport.com (Paul
Buder) wrote:

[followups set to comp.lang.c]
>
>All this talk of scanf.  I hope you people don't actually use that
>horrid function in your C code.  Can you say buffer overflow?  fgets
>and fread take a little more work sometimes but at least you can
>control the size of things getting put into your variables.

I suspect that if you did an analysis of the responses to questions
posed in c.l.c, you would find that a distillation of those responses
would be that the three most frequent responses boil down to:

1. Read the FAQ.

2. You will get better and more knowledgeable answers in [insert
appropriate newsgroup here]

3. scanf() is evil.

--

Cameron Foster
cdfoster@ix.netcom.com
http://www2.netcom.com/~cdfoster/




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

Date: Wed, 24 Jun 1998 03:48:57 GMT
From: Michael Powe <looie+gnus@teleport.com>
Subject: Re: Flames....
Message-Id: <m3btrj794k.fsf@localhost.localdomain>

>>>>> "Lloyd" == Lloyd Zusman <ljz@asfast.com> writes:

    Lloyd> rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
    >> Chris Miller <apminc@cvn.net> wrote:

    >> > It seems that newbies are comparable to flies around here.
    >> You tolerate > them for awhile but you're annoyed to all hell
    >> by them.  Lighten up a bit.  > Don't respond if you don't want
    >> to be bothered.

    >> If your house is infested with flies, don't pay any attention
    >> to them.  They'll go away.  Really.

    Lloyd> regulars here can deal with this issue.  Here are five of
    Lloyd> them that come to mind:

    Lloyd> (1) ... use killfiles, the 'n', key, etc.  In other words,
    Lloyd> ignore it.

    Lloyd> (2) ... accept that things have changed and give it no
    Lloyd> further thought.

    Lloyd> (3) ... politely and respectfully try to explain the
    Lloyd> established patterns to the newcomers, and (still politely
    Lloyd> and respectfully) try to persuade them to continue to
    Lloyd> adhere to these conventions if they don't initially do
    Lloyd> that.

    Lloyd> (4) ... treat the newcomers in an insulting and
    Lloyd> condescending manner in an attempt to chase them away or
    Lloyd> "educate" them, even going so far (for example) as to
    Lloyd> publicly equate them with foul insects such as flies.

    Lloyd> (5) ... start a moderated newsgroup which then *can*
    Lloyd> justifiably be compared to a private home, and where those
    Lloyd> who don't fit in can be easily excluded.

There is another alternative.  Start a newsgroup comparable to the
alt.comp.lang.learn.c-c++ group -- designed for 'newbies.'  People who
really want to help new users can invoke their expertise there; people
who hate 'newbies' can stay away.

mp

-- 
			     Michael Powe
			  looie@teleport.com
			 Portland, Oregon USA


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

Date: Tue, 23 Jun 1998 22:39:34 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <359066E6.9E586589@erols.com>

Then what is the solution? Don't use Perl? No. Write a good free manual?
Yes. Now, who wants to volunteer? How 'bout any of the people Carp
qw(ing) about the unavailability of said manual? Do I see RMS at the
front of that line?


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

Date: 24 Jun 1998 02:41:38 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <6mpp12$jpp$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    "Matthew O. Persico" <mpersico@erols.com> writes:
:Then what is the solution? Don't use Perl? No. Write a good free manual?
:Yes. 

No.  We already have one, thank you very much.

--tom
-- 


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

Date: Wed, 24 Jun 1998 03:02:30 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Have we got a good free Perl manual?
Message-Id: <pudge-2306982259440001@dynamic448.ply.adelphia.net>

In article <359066E6.9E586589@erols.com>, "Matthew O. Persico"
<mpersico@erols.com> wrote:

# Then what is the solution? Don't use Perl? No. Write a good free manual?
# Yes.

Huh?  THERE IS A GOOD FREE PERL MANUAL.  Even by the FSF definitions of
"free" and, I assume, of "manual".  It is probably better than every other
manual, free or proprietary, for any other software package of this size.

What may not considered free in the FSF sense is a couple of tutorials in
the Perl man pages and the perl FAQ.  But these do not constitute the bulk
of the Perl manual, if indeed they are a part of the manual at all.  I
call them tutorials and FAQs, not manuals.


# Now, who wants to volunteer?

Anyone who reasonably could probably wouldn't, since such a thing already
exists.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Wed, 24 Jun 1998 02:53:15 GMT
From: munn@bigfoot.com (Thomas Munn)
Subject: How make a variable name from a datafile?
Message-Id: <6mppuq$7r8$1@News.Alliance.Net>

  All:
     
     I am writing a perl program that stores the following data:
     
     First name is User ID, and the one that I want to Key off of.  The 
     rest of the data should be stored in the variable name (automatically 
     parsed) from the first name.  I talked to a friend and he suggested 
     "hard" references.  Frankly, I read about them but I have no idea as 
     to how to do this.  E.G. without having to manually create new 
     variables for each user encountered, using a "dynamic" naming of 
     variables that comes from the first entry of the data file itself.  
     E.G. In the first record, the program would read in the value for the 
     user name, make that a variable name, and then store the next four 
     components in that variable as an or a hash...).  Is there a simpler 
     way to do this?? 
     
     Record 1
     
     skklk02 #Key field (want variable name generated from this)
     ken l. kolassa
     16
     132
     708533
     
     Record2
     
     uscgme02 #field that I want to make a variable and store everything in
     garnet m. eckstrand
     2
     17
     68710
     uskcab05


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

Date: 24 Jun 1998 03:25:09 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How make a variable name from a datafile?
Message-Id: <6mpril$mrn$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, munn@bigfoot.com (Thomas Munn) writes
various wrong questions.

Virtually each and every time you think you need to make a variable
named after something in a data file, stop.  Use a hash,
keyed on that name.

--tom

-- 
if (*name == '+' && len > 1 && name[len-1] != '|') {  /* scary */
    --Larry Wall, from doio.c in the v5.0 perl distribution 


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

Date: 24 Jun 1998 03:27:57 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How make a variable name from a datafile?
Message-Id: <6mprnt$t1f$1@comdyn.comdyn.com.au>

In article <6mppuq$7r8$1@news.alliance.net>,
	munn@bigfoot.com (Thomas Munn) writes:
>   All:
>      
>      I am writing a perl program that stores the following data:
>      
>      First name is User ID, and the one that I want to Key off of.  The 
>      rest of the data should be stored in the variable name (automatically 
>      parsed) from the first name.  I talked to a friend and he suggested 
>      "hard" references.  Frankly, I read about them but I have no idea as 

I'd suggest a hash table.

#!/usr/local/bin/perl -w
use strict;

# Set the record separator
#
# perldoc perlvar
#
$/ = "";

# The hash to hold all the data
#
# perldoc perldata
#
my %data;

# read each record in turn from __DATA__
#
while (<DATA>)
{
	# Store all the fields in an array
	#
	my @fields = split /\n/;

	# The first field is the identifier
	#
	my $key = shift(@fields);

	# You didn't specify how you wanted the rest of the data stored.
	# I'll store it as an anonymous array reference.
	#
	# perldoc perlref
	# perldoc perllol
	#
	$data{$key} = \@fields;
}

# To prove that it works:
#
foreach my $key (keys %data)
{
	print "KEY:    $key\n";
	print 'VALUES: ', join(' : ', @{$data{$key}}), "\n\n";
}

__DATA__
skklk02
ken l. kolassa
16
132
708533

uscgme02
garnet m. eckstrand
2
17
68710
uskcab05

OUTPUT:
KEY:    skklk02
VALUES: ken l. kolassa : 16 : 132 : 708533

KEY:    uscgme02
VALUES: garnet m. eckstrand : 2 : 17 : 68710 : uskcab05

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd.       | population.
NSW, Australia                      | 


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

Date: Tue, 23 Jun 1998 21:51:27 -0500
From: "jose" <joseg@nousit.net>
Subject: Re: how to write CGI scripts to connect form in HTML to MS Access
Message-Id: <6mppls$rkm$1@news.usit.net>

Why not try ASP, instead. If you are going to be using MS NT w/IIS4 or IIS3,
there's alot of code floating around, check out MS site on that or the
newsgroup microsoft.public.inetserver.iis.activeserverpages. I know of some
sites but don't have them close..

Jose

Ps. It's much more easy to use, than writing cgi script...


>Hi All
>Right now I have to develop the web application for my class.
>Unfortunately I don't know how to do that. Now I have forms in HTML
>format and tables in MS Access. I don't know how to write CGI script
>using perl to add, delete, update, and query. If anyone knows how to,
>please feel free to give me the answer.
>My email is buranee@gte.net.
>Thank you in advance
>
>P.S. I want to run this application on Windows 95/NT with MS Web
>Server(IIS4)
>




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

Date: 23 Jun 1998 21:26:26 -0500
From: spaf@cs.purdue.edu (Gene Spafford)
Subject: I need letters in support of a nomination for Larry
Message-Id: <6mpo4i$844@dorsai.cs.purdue.edu>

Greetings.

I am going to nominate Larry Wall for an award.  It's a very nice
award, and I've already exchanged email with Larry about it.   I'm not
going to name the award here, because I don't want several hundred
people emailing the nomination committee and swamping them!  However, I
can assure you that Larry deserves it -- it is to recognize people who
have made outstanding contributions to computing early in their
careers...and that certain describes Larry.

Now for the good part.  Award nominations are more successful when they
have supporting documentation or "seconding" letters.   That's where you can
come in.

If you think Larry has done something exceptional with his software
development for the community (rn, dist, patch, and perl, to name a few), 
then you can help me put together a great nomination package.

If you want to help, all I need is a letter by July 20 at the latest.  The
letter should:
  1) be written on paper -- email is not acceptable
  2) be no more than 3 pages long
  3) be written on institutional letterhead (personal letters don't count here)
  4) describe the importance/novelty/etc of Larry's software.  This must
	especially include reference to at least "rn" or "patch" in addition
	to perl
  5) say a few words about how Larry's software and personal efforts have
	had a positive impact on aspects of computing technology (e.g., how
	perl has made CGI scripts so easy to produce, or how patch changed
	the way software was written and shared on the net).
  6) be written neatly, in English, and using proper grammar and spellings:
	referring to Larry as the Supr3m3 Kode d00d may be a high honor
	to you, but the people who will read the letters won't get it.
  7) be addressed "to whom it may concern"

Send your letters to me @ the address in my sig file.  I will write up
the nomination and submit everything as a package.

Please don't post follow-ups to me -- I stopped reading Usenet news in
1993, and haven't felt the urge to start again. :-)    If you have a
burning question about this posting, you can send me email directly.

Thanks!
-- 
Gene Spafford, CERIAS Director
Computer Sciences Building
Purdue University, W. Lafayette IN 47907-1398
spaf@cerias.purdue.edu	http://www.cerias.purdue.edu


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

Date: Tue, 23 Jun 1998 22:47:20 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: learning Perl?
Message-Id: <359068B8.400461C7@erols.com>

Write, write, write, write and write some more. Then write, write and
write.

It's the only way. And expect your progress to spikey. That means you'll
muddle along at a low level and then BAM! lights will go on in your
brain, fireworks will go off and you'll have mastered another concept.

That's waht has happened to me. At the last job, I had a Perl guru who'd
write the stuff and I'd poke around enough to barley be able to maintain
it.

Then I jot the new job and decided to stake my reputation on re-writing
a 2500 line 'C' progam in perl. Why? 'cause I was convinced it was the
right tool for the job.

About day 2 of this project, I finally crossed the scalar/array/hash
threshold, the anonymous array/hash threshold and the reference
threshold, all at once. Why? Because I finally NEEDED them. It forced me
to read the relevent sections of Programming Perl AND try the stuff.

So, make sure you have a project that needs Perl and go for it.


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

Date: 24 Jun 1998 01:45:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: moving perl -ne into a file?
Message-Id: <6mploj$sei$1@comdyn.comdyn.com.au>

In article <358FFB30.F4B06DD3@acuityinc.com>,
	markf@acuityinc.com writes:
> perl -ne 'print if (/LIB PART/ ? ($c = 18) : (--$c > 0))' proj.dat
> 
> This command line works fine, but I would like to put it into a file and
> have the output put into an array, split if possible.  

Check the perlrun man page to find out what the -n option does. Write
a script that does exactly that.

# perldoc perlrun

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | Can't say that it is, 'cause it ain't.
NSW, Australia                      | 


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

Date: 24 Jun 1998 03:33:05 GMT
From: Thomas van Gulick <melkor@Cal040031.student.utwente.nl>
Subject: Parsing <tags>
Message-Id: <6mps1h$98$1@dinkel.civ.utwente.nl>

I was wondering if this might be done using a faster routine. What it does
is scan for a certain tag (eg table in <table cellpadding="0">) and returns
a hash containing it's contents, and 2 other hashes containing the
attributes in the opening and closing tags (ie, cellpadding => 0)

sub obtain_tag {
    my ($self,$tag,$pos) = @_;

    my $html      = $self->[$HTML];
    my $tag_start = index ($$html,"<$tag",$pos);

    if ($tag_start != -1) {

        my $tag_end = index ($$html,'>',$tag_start + 1 + length ($tag));

        if ($tag_end != -1) {

            my $start   = $tag_start + 1 + length ($tag);
            my $attribs = substr ($$html,$start,$tag_end-$start);
            my %INFO;
            my $ndx     = 0;

            while (($ndx = index ($attribs,' ',$ndx)) != -1) {
                my $firstis;
                if (-1 != ($firstis = index ($attribs,'=',$ndx))) {
                    my $lastquote;

                    if (-1 != ($lastquote = index
                      ($attribs,'"',$firstis+2))) {

                        my $key = substr ($attribs,
                              $ndx+1,$firstis-2-$ndx+1);
                        my $val = substr ($attribs,
                              $firstis+2,$lastquote-$firstis-2);

                        print STDERR "$key = $val\n";

                        $INFO{$key} = $val;

                        $ndx = $lastquote+1;
                    }
                }
            }

            $INFO{'tag_start'} = $tag_start;
            $INFO{'tag_end'}   = $tag_end;

            return \%INFO;
        } else {
            ERROR->write ($location,
             "Could not find closing '>' for tag $tag");
        }
    }
    return 0;
}

sub obtain {
    my ($self,$tag) = @_;

    my $OPEN = obtain_tag ($self,$tag,$self->[$CNT]);

    if ($OPEN) {

        my $open  = $$OPEN{'tag_end'} ;
        my $close = $self->[$CNT];

        while (1) {

            my $NEWOPEN = obtain_tag ($self,$tag,$open);
            my $CLOSE   = obtain_tag ($self,'/'.$tag,$close);

            # !$NEWOPEN, ie: <p></p>, an $OPEN is generated, a $CLOSE is
			# generated, but no $NEWOPEN can be found, handles:
            #   <p></p>
            # $$CLOSE{'tag_start'} < $$NEWOPEN{'tag_start'}
            # possibilites:
            #   0123456789ABCD
            #   <p></p><p></p>      3 < 7   TRUE
            #   <p><p></p></p>      6 < 3   FALSE

            if ($NEWOPEN == 0 || ($CLOSE && $NEWOPEN &&
               ($$NEWOPEN{'tag_start'} > $$CLOSE{'tag_start'}))) {

                #found a match

                my %INFO;
                my $html = $self->[$HTML];

                $INFO{'CLOSE'}      = $CLOSE;
                $INFO{'OPEN'}       = $OPEN;

                if ($CLOSE) {
                    $INFO{'CONTENT'} = substr ($$html,$$OPEN{'tag_end'}+1,
                                $$CLOSE{'tag_start'}-$$OPEN{'tag_end'}-1);
                    $self->[$CNT] = $$CLOSE{'tag_end'};
                } else {
                    $INFO{'CONTENT'} = '';
                    $self->[$CNT] = $$OPEN{'tag_end'};
                }

                return \%INFO;
            }
            #set pointer after the NEWOPEN tag

            $open  = $$NEWOPEN{'tag_end'};
            $close = $$CLOSE{'tag_end'};
        }
    }
    return 0;
}

Thomas
-- 
http://utumno.student.utwente.nl/
melkor@utumno.student.utwente.nl


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

Date: 24 Jun 1998 03:42:05 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Parsing <tags>
Message-Id: <6mpsid$o5h$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    Thomas van Gulick <melkor@Cal040031.student.utwente.nl> writes:
:I was wondering if this might be done using a faster routine. 

Is there some reason why you don't use the canned parsing
returns from LWP?

--tom
-- 
 Imagination is more important than knowledge
		 -- Albert Einstein


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

Date: 24 Jun 1998 01:34:31 GMT
From: ptjapkes@novagate.com (Paul Tjapkes)
Subject: Re: Perl standard distribution and IIS 4
Message-Id: <6mpl37$3ic$0@205.138.138.167>

On Fri, 19 Jun 1998 14:17:06 +1000, "Matt Eckhaus"
<matt2@lonelyplanet.com.au> wrote:

The standard 5.004 distribution will run fine with IIS.  IIS 4 is hard
to configure.

If you have the permissions right and have .pl associated with
c:\perl\bin\perl.exe %s %s it should work.  The %s must be lowercase.

>Does anbody have any information about running the Perl standard
>distribution (5.004_02) with Internet Information Server 4.0? I can't get
>IIS 4 to run my Perl scripts at all...
>
>I have heard that PerlIS from ActiveState works, but I need Perl 5.004,
>which means I need the standard distribution. I haven't yet heard of anybody
>doing this.
>
>Any help would be very much appreciated...
>
>Matt Eckhaus
>matt2@lonelyplanet.com.au
>



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

Date: 24 Jun 1998 12:09:36 +1000
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: printf in assignments
Message-Id: <yeosokvft3z.fsf@kudu.ind.tansu.com.au>

"James M. Stern" <jstern@world.northgrum.com> writes:

> the count wrote:
> > 
> > I checked the FAQ but see this addressed, so here I am (if it is in
> > there, then it is buried well, or only gotten at obliquely, and I missed
> > the reference...)
> > 
> > I want to assign the contents of a printf to one element of an array,
> > like so:
> > $specs[$counter] = printf("\"%4s\", ", $variable);
> > 
> > This, obviously, doesn't work as $specs[$counter] is assigned a value
> > of 1 - the return value of a successful printf!
> 
> perldoc -f sprintf
> 
> -- 
> James M. Stern -- Views here are my own, not my employer's.  
> (Hawthorne, CA)

Note
====

Those from a C programming background should also note that the return value
of a successful Perl printf is 1; while the return value of a C printf
is number-of-characters-printed. Maybe this should be documented in perltrap
in the 'C traps' section; next to the note about printf not supporting the
'*' format.

If you need to get number of characters printf will print;
try a combination of sprintf and length like this:

$width= length(sprintf("%d%s",$count," bananas"));

Stuart Cooper
stuartc@ind.tansu.com.au


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

Date: Wed, 24 Jun 1998 08:12:43 -0700
From: Ken Ingram <kingram@sdl.org>
Subject: Problem compiling in Linux
Message-Id: <3591176A.FED23F8B@sdl.org>

Anybody have suggestions on dealing with this error trying to compile
Perl5.004_04 on Linux 2.0.30?
======================================================================

I've tried to compile and run a simple program with:

        cc -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-L/usr/local/lib -o try try.c -lgdbm -ldb -ldl -lm -lc
        ./try

and I got the following output:

/usr/i486-linux/bin/ld: cannot open -ldl: No such file or directory
I can't compile the test program.
You have a BIG problem.  Shall I abort Configure (and explain the
problem)
[y]
Ok.  Stopping Configure.



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

Date: Wed, 24 Jun 1998 03:18:37 GMT
From: "Dave Methvin" <dm@ho.com>
Subject: Regex dilemma
Message-Id: <he_j1.124$lC3.3299462@news.rdc1.md.home.com>

OK, I know there has to be a elegant (preferably laconic) solution to this.
I have some data coming in that looks like:

^L
Name: George Watson
Address1: 123 Any Street
Address2:
City: Columbus
State: GA
^L
Name: Sally Simpson

IOW, the records are separated by formfeeds and the name-value pairs are one
per line with a colon between them. I wanted to use this code to parse each
record:

  local $/ = '\014';
  while ( <INFILE>) {
    %fields = m/^([^:]+):\s*(.*)$/mg;
    # do something with the record here...
  }

The problem is that empty items like Address2 mess up the pairing that I
wanted to capture in the match. Any ideas on how to adjust the regex to fix
this? Ideally I'd like to get an empty string or undef for items that had no
value, but I'd settle for a space or other placeholder.








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

Date: Tue, 23 Jun 1998 23:00:04 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Storing and passing object references - html crap
Message-Id: <35906BB4.8F34416B@erols.com>

Actually, even though I agree that Usenet is not the place for anything
except pure text, don't put all browser-posted files in the same bucket.
You're reading this, aren't you? And it isn't killing your eyes, yes.

Better to have the auto-mailed "welcome to the newsgroup" contain a
paragraph that says:

If you use Netscape for posting, post using text only. After all, what
good is a variable spaced font when you're discussing CODE?!?!?!

Tom Phoenix wrote:
> 
> On Mon, 22 Jun 1998, Colin Kilburn wrote:
> 
> > Why the hell does Netscape let you send HTML
> > and text at the same time anyway?
> 
> There's a bug in all recent versions of Netscape's newsreader: The 'post'
> command is enabled. :-)
> 
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


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

Date: 24 Jun 1998 02:46:54 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: string substitution
Message-Id: <6mppau$sp5$1@comdyn.comdyn.com.au>

In article <35902B7F.2424@tus.ssi1.com>,
	Hui Tang <hui.tang@tus.ssi1.com> writes:
> Hi, all,
> 
> I saw a problem when I do string substitution if the string is a
> variable with meta characters, e.g,

# perldoc perlre

Have a look at the \Q and \E quantifiers.

You might also be interested in the quotemeta function

# perldoc -f quotemeta

Did you actually think of checking the documentation?

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.       | cynical. It's perfectly easy to be
NSW, Australia                      | cynical.


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

Date: 24 Jun 1998 02:24:03 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: system() and security again
Message-Id: <eli$9806232222@qz.little-neck.ny.us>

In comp.lang.perl.misc, Marc Haber <Marc.Haber-usenet@gmx.de> wrote:
> Eli the Bearded <*@qz.to> wrote:
> >I concur. Only use system if you need the shell's interpretation of
> >those meta-characters (and in that case they should be ones that
> >/you/ as author of the program have provided, not ones that the user
> >has provided).
> exec() does the same than system(), invoking a shell when
> metacharacters are present.

Okay, fair enough.

> And I am concerned about metacharacters
> contained in strings that come in from the outside and are not
> supposed to contain any metacharacters..

My email address is supposed to contain metacharacters. HTH.

Elijah
------
found that <#@qz.to> breaks some uucp systems (they see # as a comment...)


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

Date: Wed, 24 Jun 1998 02:57:15 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Testing perl knowledge
Message-Id: <pudge-2306982254300001@dynamic448.ply.adelphia.net>

In article <3590037E.31931C0D@newfangled.com>, "Michael S. Brito, Jr."
<mike@newfangled.com> wrote:

# Is there no perl certification, or atleast certificate of completion for
# some perl course????????

I am a Certified Perl Engineer (CPE).  I sent e-mail to a guy who
certified me.  I also certified myself.

I am also a Certified Excessive Punctuation Eliminator (CEPE).  You appear
to be in dire need of my services.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 24 Jun 1998 03:36:16 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Testing perl knowledge
Message-Id: <6mps7g$l52$1@news.NERO.NET>

In article <pudge-2306982254300001@dynamic448.ply.adelphia.net>,
Chris Nandor <pudge@pobox.com> wrote:
>I am a Certified Perl Engineer (CPE).  I sent e-mail to a guy who
>certified me.  I also certified myself.

You should be careful with this. Many states assign special legal status
to the title "engineer". 



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

Date: 24 Jun 1998 01:15:39 GMT
From: ac1@fspc.netsys.itg.telecom.com.au (nobody)
Subject: Re: Windows95, Perl-32 and Personal Web Server (PWS)
Message-Id: <6mpjvr$2vo@newsserver.trl.OZ.AU>

A similar experience with PWS, I went to the Xitami camp but there are
a number of web server products on www.winfiles.com.

AC

Heribert Wettels (heribert.wettels@sueddeutsche.de) wrote:
: I also experienced problems with the PWS from "The Evil Empire" and just
: installed OmniHTTPD which turned out to work much better. It's freeware and
: can be downloaded from http://www.fas.harvard.edu/~glau/httpd/

: Heribert


: Pete Sattler wrote:

: > > I am trying to set-up an environment on Windows 95 for developing web
: > > applications.  I have installed ActiveState's Perl for Win32 (build 316)
: > > along with Microsoft's personal web server (PWS).  I'm finding that
: > anytime
: > > I try to make a call using system() or backticks PWS hangs.  I've found
: > > some recent postings in this newsgroup that discussed the lack of
: > > intelligence in the standard Windows command shell (command.com).  I
: > > installed the more intelligent 4DOS shell from JP Software, but I have
: > been
: > > unable to correct the problem.
: > >
: > See http://support.microsoft.com/support/kb/articles/q156/7/55.asp for
: > Microsoft's "official" resolution, which didn't seem to work for Win95.
: >
: > > Has anyone else been able to successfully implement this environment?
: > Any
: > > help is greatly appreciated!
: > >
: > > Pete Sattler
: > > Chase Manhattan Bank
: > >





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

Date: 24 Jun 1998 01:52:18 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Would someone tell me what this means?
Message-Id: <6mpm4i$sei$2@comdyn.comdyn.com.au>

In article <01bd9eef$d228bf20$1cb0c9d0@chiefs>,
	"Chris Edwards" <chiefs@fulton-net.com> writes:
> I would like to know what these few short lines mean.

pretty bad stuff.

> if ($FORM{'name'}) {

If $FORM{'name'} evaluates to a true value

>       $name = "$FORM{'name'}";

$name will contain the value of $FORM{'name'}

>       $name =~ s/"//g;
>       $name =~ s/<//g;
>       $name =~ s/>//g;
>       $name =~ s/\&//g;

replace any occurrence in $name of ", <, >, and & with nothing.

>    }
>    else {
>       &error(no_name);

if $FORM{'name'} does not evaluate to a true value, call the error sub.

This should generate a warning, or an error, since you're using a
bareword where you shouldn't. You are also missinbg a closing bracket,
which is a syntax error.

Now, how do you expect to ever program anything in Perl if you can't
read the above lines? Did you ever consider reading some of the
documentation that comes with perl? Did you ever consider buying a
good book that explains Perl? This stuff really is too basic to not be
understood.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd.       | population.
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 2955
**************************************

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