[11891] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5490 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 26 20:17:06 1999

Date: Mon, 26 Apr 99 17: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           Mon, 26 Apr 1999     Volume: 8 Number: 5490

Today's topics:
    Re: "learning perl" does not seem to be written well <cassell@mail.cor.epa.gov>
    Re: "learning perl" does not seem to be written well <gellyfish@gellyfish.com>
    Re: autoincrement magic a..z <uri@sysarch.com>
    Re: autoincrement magic a..z <squid@panix.com>
    Re: autoincrement magic a..z <uri@sysarch.com>
    Re: autoincrement magic a..z (Tad McClellan)
    Re: Can a DNS lookup be performed from within perl ? <rradhakr@ececs.uc.edu>
        cgi development exorcist1@my-dejanews.com
    Re: cgi script <gellyfish@gellyfish.com>
    Re: Counting files in a dir. (Tad McClellan)
    Re: Country of a visitor <occitan@esperanto.org>
    Re: Eliminate elements from array with second array? (Tad McClellan)
    Re: Extracting attachments from e-mail (Linux) <gellyfish@gellyfish.com>
    Re: FAQ 4.31: How do I pad a string with blanks or pad  <gellyfish@gellyfish.com>
    Re: FAQ 4.31: How do I pad a string with blanks or pad  (Larry Rosler)
    Re: FAQ 4.31: How do I pad a string with blanks or pad  <uri@sysarch.com>
    Re: FAQ 4.54: What happens if I add or remove keys from (Charles DeRykus)
    Re: FAQ 7.19: Why doesn't "my($foo) = E<lt>FILEE<gt>;"  <cassell@mail.cor.epa.gov>
    Re: Free Web Hosting with CGI <selectthree@gsig-net.qc.ca>
    Re: How to ftp in perl? <gellyfish@gellyfish.com>
        Insert "\n" <andylee@prodigy.net>
    Re: Insert "\n" (Bob Trieger)
    Re: IPC left overs brad_doctor@my-dejanews.com
    Re: Limit 10 matches to display on screen (Randal L. Schwartz)
        Multiline comments in perl (Eric Smith)
    Re: Multiline comments in perl <gellyfish@gellyfish.com>
    Re: Multiline comments in perl <jeromeo@atrieva.com>
    Re: Multiline comments in perl <paladin@uvic.ca>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 26 Apr 1999 15:34:46 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <3724EA06.DFBF67C3@mail.cor.epa.gov>

Scratchie wrote:
> 
> Tom Christiansen <tchrist@mox.perl.com> wrote:
> : As others have pointed out, _Learning_Perl_ (the LLama) is really only
> : tuned for those programmers (not non-programmers aka Prisoners of Bill)
> : already conversant with the small-script culture that gave birth to
> : Perl; that is, the Unix sysadmin cum toolsmith culture.
> 
> How odd, then, that I was able to learn Perl from this book with virtually
> no knowledge of the "Unix sysadmin cum toolsmith culture." I didn't start
> to appreciate the usefulness of Unix in general (pipes, redirection, shell
> scripts, that sort of thing) until I'd been programming Perl for a couple
> of years. Surely I'm not the only one.

I'm backing you on this one, Art.  My background was much more
mainframes and CP/M-DOS [although I did get to work a little on SunOS]
when I first heard of Perl.  It was my exposure to Perl that led me 
_post_hoc_ to awk and sed.

I do not believe that it is the Unix 'toolsmith' culture that helps.
I believe that it is exposure to other programming languages that
helps.  Perl was perhaps the tenth language I tackled.  Of course, 
that's purely a ballpark number.  It's not anywhere near Randal's
47 [I believe he cited that number back in 1997, so it's higher by
now].

But exposure to basic programming concepts helps enormously.  So
much, in fact, that most of us in this ng tend to completely
overlook the issue until we hear `those' complaints.  And having
seen multiple implementations of loops, flow control constructs,
etc. made a big difference.

The Perl area where I had the most trouble at first was, of course,
regexes.  No sed or awk background, remember?

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 26 Apr 1999 22:53:47 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <7g2qpr$51s$1@gellyfish.btinternet.com>

On Mon, 26 Apr 1999 12:20:39 -0400 Tad McClellan wrote:
> ralawrence@my-dejanews.com wrote:
> : In article <0lk1g7.t73.ln@magna.metronet.com>,
> :   tadmc@metronet.com (Tad McClellan) wrote:
> : > ralawrence@my-dejanews.com wrote:
> : >
> : > : Here is how I see it (and I *am* a newbie so bear with me).
> : >
> : >    But you don't have it quite right.
> 
> : Thanks to all of you that pointed out how hopelessly wrong I was.
> 
> : I've now made a total tit out of myself infront of 16 million odd people.
> 
> 
>    It may be painful, but public humiliation pretty much ensures
>    that you don't forget the "lesson".

Another recruit for the Perl Spartacist Party ....

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 26 Apr 1999 18:10:13 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: autoincrement magic a..z
Message-Id: <x7ogkb9goq.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> [Posted and a courtesy copy mailed.]
  LR> In article <x7so9n9j6z.fsf@home.sysarch.com> on 26 Apr 1999 17:16:04 -
  LR> 0400, Uri Guttman <uri@sysarch.com> says...
  LR> ...
  >> you could also check the length with
  >> 
  >> length( $i ) == 1 && $i le 'z'

  LR> And you can just as well skip the second part of the test, which is 
  LR> redundantly superfluous.

that's because i wanted to write it to government specs and make sure
that if the length op ever was broken, the second might catch the
runaway loop. (actually it wouldn't!)

uri (who writes code for the dept. of redundancy dept.)


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 26 Apr 1999 18:53:25 -0400
From: Yeoh Yiu <squid@panix.com>
Subject: Re: autoincrement magic a..z
Message-Id: <oxgeml72duj.fsf@panix.com>

Uri Guttman <uri@sysarch.com> writes:

>   YY> 	for ($i="a"; $i le "z"; $i++) {print "$i";}
> 
>   YY> doesn't print ouit a to z.
> 
> because when $i eq z, it passes the test, prints and then increments to
> 'aa'. and that fails the le test since 'aa' IS le 'z'. perl does a
> lexigraphical compare and length doesn't come into the picture.
> 
> as you have seen it works fine with $i ne 'aa'.
> 
> you could also check the length with
> 
> 	length( $i ) == 1 && $i le 'z'

Thank you.

Why does autoincrement magic applied to "z" return a value
which is lexigraphically less that "z" ? Does (autoincrement
magic applied to characters) not live in legigraphical space ?


squid.


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

Date: 26 Apr 1999 19:09:50 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: autoincrement magic a..z
Message-Id: <x7g15n9dxd.fsf@home.sysarch.com>

>>>>> "YY" == Yeoh Yiu <squid@panix.com> writes:

  YY> Uri Guttman <uri@sysarch.com> writes:
  YY> for ($i="a"; $i le "z"; $i++) {print "$i";}
  >> 
  YY> doesn't print ouit a to z.
  >> 
  >> because when $i eq z, it passes the test, prints and then increments to
  >> 'aa'. and that fails the le test since 'aa' IS le 'z'. perl does a
  >> lexigraphical compare and length doesn't come into the picture.
  >> 
  >> as you have seen it works fine with $i ne 'aa'.
  >> 
  >> you could also check the length with
  >> 
  >> length( $i ) == 1 && $i le 'z'

as larry rosler said, the second part is redundant.

  YY> Why does autoincrement magic applied to "z" return a value
  YY> which is lexigraphically less that "z" ? Does (autoincrement
  YY> magic applied to characters) not live in legigraphical space ?

interesting question. they are different animals and since their origins
are different they don't play well together.

lexical compares are as old and any language that can do them. perl's
derives from memcmp and other string compare functions in c.

the automagic increment is not related to that. i don't know its exact
origin (search dejanews for a thread i started a few months ago on the
origons of perl features). it is used more often in .. expressions like:

	print 'a' .. 'z'

which gets you what you did in a full loop. i suspect it stops by using
an eq op but it is inclusive whereas $i eq 'z' in the for loop is
exclusive! which tells us that if you want to write the loop with eq,
you can't do the test in the for part, it has to be in the body:

	for ( $i = 'a' ; 1 ; $i++ ) {

		blah ;

		last if $i eq 'z' ;
	}

it might be hacked into the continue clause or a continue block but i
will leave that as an exercise to others.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Mon, 26 Apr 1999 14:03:13 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: autoincrement magic a..z
Message-Id: <1p92g7.u04.ln@magna.metronet.com>

Yeoh Yiu (squid@panix.com) wrote:
: the block : for ($i="a"; $i lt "z"; $i++) {print "$i";}

: But changing the lt to le does not print out

: 	abcdefghijklmnopqrstuvwxyz


   foreach ( 'a' .. 'z' ) {
      print;
   }


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 26 Apr 1999 19:38:54 -0400
From: Rajesh Radhakrishnan <rradhakr@ececs.uc.edu>
Subject: Re: Can a DNS lookup be performed from within perl ?
Message-Id: <3724F90E.4C7F5528@ececs.uc.edu>

Benjamin Franz wrote:

> In article <7g0gfb$ntk$5@client2.news.psi.net>,
> Abigail <abigail@fnx.com> wrote:
> >Benjamin Franz (snowhare@long-lake.nihongo.org) wrote on MMLXIII
> >$$
> >$$ Surprisingly enough, '1234567' could (almost) be an IP address.
> >$$
> >$$ Try http://3521755779/snowhare/ in a web browser (note -
> >$$ the Squid proxy server _mistakenly_ rejects straight 32 bit
> >$$ addresses as being invalid).
> >
> >I don't think it _mistakenly_ does so. It might actually just follow
> >the specs.
> >
> >While 3521755779 might be a valid IP address, RFC 1738 doesn't find
> >http://352175579/snowhare/ a valid URL. And that's what matters.
>
> True, but RFC 1738 is starting to show its age. You
> can't use a IPv6 IP address as a URL with it, for example.
> I would view that as a defect in RFC 1738.
>
> >Of course, that has nothing to do with Rajesh question. If his server
> >always uses IP numbers with 3 dots, /(\d+\.\d+\.\d+\.\d+)/ will do just
> >fine. But (s)he has to add the \'s.
>
> Actually, it won't. It suffers from false triggering in that form, still.
> It is legal for the local part of the URL to contain dot quad components.
> S(he) needs to completely spec the log format correctly. For a
> CLF log,
>
> ($Domain,$rfc931,$authuser,$TimeDate,$Request,$Status,$Bytes) =
>  /^(\S+) (\S+) (\S+) \[([^\]\[]+)\] \"([^"]*)\" (\S+) (\S+)/o;
>
> For an ECLF log,
>
> ($Domain,$rfc931,$authuser,$TimeDate,$Request,$Status,$Bytes,$Referrer,$Agent) =
>  /^(\S+) (\S+) (\S+) \[([^\]\[]+)\] \"([^"]*)\" (\S+) (\S+) \"?([^"]*)\"? \"([^"]*)\"/o;
>
> --
> Benjamin Franz

Hi,

My solution for Uri's problem was conjured up in a couple of mins. Yes, I made a blunder in
the regex by not placing the \'s. Thanks to all for pointing that out.

The solution  I gave was to help solve Uri's problem only. Nothing more.

I tried that example on the webserver logs that I have access to and it worked. So, I
posted it with the comments in the code so that anyone else referring to it, could play
with it for their specific needs.

ciao
Rajesh



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

Date: Mon, 26 Apr 1999 23:17:45 GMT
From: exorcist1@my-dejanews.com
Subject: cgi development
Message-Id: <7g2s6l$c4r$1@nnrp1.dejanews.com>

Hello, i really have no experience in programming whatsoever. I'm am opening
up a website and i am looking for a programmer who has a good knowledge of
cgi who can work with it. Possible $$$ involved. e-mail me at snl1ve@aol.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 26 Apr 1999 21:11:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: cgi script
Message-Id: <7g2kqa$4r2$1@gellyfish.btinternet.com>

On Mon, 26 Apr 1999 12:40:46 GMT smnayeem@my-dejanews.com wrote:
>   alainch <alain_chiorboli@email.sps.mot.com> wrote:
>> If you are under unix you can try to set the setgid bit for your cgi
>> script: chmod +s cgi_script_name
> how about if im using WinNT with ActivePerl?

You should ask someone local who knows about NT to tell you how - this is
to do with server configuration and not Perl.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 26 Apr 1999 14:21:50 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Counting files in a dir.
Message-Id: <ura2g7.u04.ln@magna.metronet.com>

stevenabell (stevenabell@hotmail.com) wrote:

: If the answers to some of my questions are in the FAQs then I'm
: afraid that you'll have to forgive me. I did look through them a
: week or so ago, but since then I don't seem to have been able to get
: back in, 


   "in" to where?

   If you cannot access files installed on your hard disk, then
   you have bigger problems than Perl questions...


: and a few rather urgent problems have come up since.


   If you find yourself saying "urgent" and really really
   meaning it, then the solution is to hire a consultant
   to take care of it for you, not post to Usenet...


: 1. Is it possible in Perl to count the number of files in a directory
: and assign that to a variable? 


   Yes.


: Because the files are situated in a 
: UNIX directory, I did think of doing something like:

: `ls testdir/*.* > list`
:    and then count the number of lines in "list", 


   But that won't do what you said you wanted to do.

   It will not count files whose name starts with a dot.

   It will count directories/pipes/sym links/etc... as "files".


: but surely there's
: another way? (I don't even know the correct syntax for the above to
: work)


   It is in the perlipc.pod file on your HD. Go find it.

      perldoc -f opendir

      perldoc -f readdir

      see also 'file test' in perlfunc.pod, also on your HD somewhere.


: 2. I have a number of files which I must perform a UNIX function on.
: Well, in fact it's a Shell application, called "stoplist". What I need
: to do is apply "stoplist" to each document and then place the treated
: documents in another directory. The original number of files to be
: treated will always vary, but will always be grouped together in the 
: same directory. So for example, if we have the following files:

: /mydir/file1
: /mydir/file2
: /mydir/file3

: I want to apply "stoplist" to them so that I have:

: /stopped/file1.stop
: /stopped/file2.stop
: /stopped/file3.stop


   I don't see a question there anywhere.

   Got a question?

   Surely you don't want us to write it for you, do you?

   Particularly since it is "urgent".


   If you tell us what part you are stuck on, we might be
   able to suggest how to get past that part.


: 3. Because each file is going to have a different directory structure,
: ie - we could have the following:

: /stopped/chair/table/file1.stop
: /stopped/chair/file2.stop
: /stopped/chair/table/file3.stop

: what I need to do is rename each file according to the length of its
: path, 


   But the length of the paths for 'file1.stop' and 'file3.stop'
   are both the same (31 characters).

   So what do you really mean?


: so that they are renamed as follows:

: file2.stop     ->      doc1
: file1.stop     ->      doc2
: file3.stop     ->      doc3


   rename('/stopped/chair/file2.stop', '/some/other/dir/doc1') ||
     die "could not rename  $!";


: where "doc1", "doc2" etc are written to another unique directory.

: 4. I have a Perl script set up to reply to a form (written in HTML),
: but when the script generates the results of the form back to the
: user, it continues to search for something else, thereby forcing the
: user to click on "Stop" in the browser (followed by "Transfer
: Interrupted"). Simplified, the script looks something like:

: if {$var eq "red"}
:    &return;
:    exit;
:    else {$var eq "blue"}
:    exit;


   This is the Perl newsgroup.

   We discuss Perl here.

   That is not Perl code.

   Did you mean to post in some other newsgroup?


: sub return
: {
: print "<HTML>......"
: }

: Even though I have the "exit"s in the script, when it generates the
: results it still doesn't bomb out.


: Like I said, if the answers to any of these are in the FAQs, then
: please accept my apologies. Any replies / solutions would make it a
: lot easier to sleep at night!


   Apologizing does not undo the wrong.


   ME:  I'm sorry for robbing that 7-11 your honor.

   JUDGE:  Oh. OK. Case dismissed then.

   Right.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 26 Apr 1999 22:43:41 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Re: Country of a visitor
Message-Id: <7g2q6s$a5a$1@nnrp1.dejanews.com>

In article <37249DA6.F0DE6944@mail.cor.epa.gov>,
  David Cassell <cassell@mail.cor.epa.gov> wrote:

> Since it is not safe to deduce the preferred language from one's
> country of posting [e.g., my cousin in Israel prefers English],
> locale issues remain sticky.  I still think one's best option is
> asking your visitors what language/customs they prefer.  If
> someone says 'Mandarin' as a joke, when they only speak English
> [or American], then they get what they deserve - a screen full of
> ideographs.

No, HTTP provides a means for that!  Modern browsers will tell the server what
languages they accept in order of decreasing preference, and the server should
comply if it has the language handy for the requested document.  For my pages
http://beam.to/iPerl/, for example, I have configured Apache thus:

Options +MultiViews

AddLanguage de .de
AddLanguage en .en
AddLanguage eo .eo

LanguagePriority eo de en

This means that I have three versions of every file, which I distinguish by
not having an index.html, but rather tacking the language code onto the end,
e.g. index.html.eo or index.html.de.  Now if a browser was set up to
requeset, say, the german language (as as german Netscape is by default), my
server will deliver that. If the server requests no language, or one I don't
have, the priority list is checked through to find Esperanto, if not found
German or else English.

best regards -- Daniel

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 26 Apr 1999 14:24:58 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Eliminate elements from array with second array?
Message-Id: <q1b2g7.u04.ln@magna.metronet.com>

lou@visca.com wrote:
: My question concerns finding the best way to eliminate elements from an array
: if they contain any of a list of strings from another array.


   That is called the "set difference".


: Is there a better way to do this?


   Perl FAQ, part 4:

      "How do I compute the difference of two arrays?  
       How do I compute the intersection of two arrays?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 26 Apr 1999 20:55:57 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Extracting attachments from e-mail (Linux)
Message-Id: <7g2jst$4qs$1@gellyfish.btinternet.com>

On Mon, 26 Apr 1999 01:47:29 +0200 Mats Pettersson wrote:
> Hi!
> 
> Are there any modules or similar that can handle e-mail? Especially
> attachments?
> 

Yes. Look on CPAN for modules beginning with MIME:: .

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 26 Apr 1999 20:37:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: FAQ 4.31: How do I pad a string with blanks or pad a number with zeroes?
Message-Id: <7g2ipe$4qp$1@gellyfish.btinternet.com>

On Mon, 26 Apr 1999 10:59:26 +0200 Philip 'Yes, that's my address' Newton wrote:
> Tom Christiansen wrote:
>> 
>> (This excerpt from perlfaq4 - Data Manipulation
>>     ($Revision: 1.46 $, $Date: 1999/04/20 18:59:53 $)
> [...]
>>         # Left padding with blank:
>>         $padded = sprintf( "%${pad_len}s", $text ) ;
>> 
>>         # Right padding with blank:
>>         $padded = sprintf( "%${pad_len}s", $text ) ;
> 
> I must confess I fail to see the difference between those two bits of
> code. Can anyone else enlighten me?
> 

Its that cunning invisible minus sign in the second ;-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 26 Apr 1999 15:30:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 4.31: How do I pad a string with blanks or pad a number with zeroes?
Message-Id: <MPG.118e88f3e40ccf41989948@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7g2ipe$4qp$1@gellyfish.btinternet.com> on 26 Apr 1999 
20:37:02 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> On Mon, 26 Apr 1999 10:59:26 +0200 Philip 'Yes, that's my address' Newton wrote:
> > Tom Christiansen wrote:
> >> 
> >> (This excerpt from perlfaq4 - Data Manipulation
> >>     ($Revision: 1.46 $, $Date: 1999/04/20 18:59:53 $)
> > [...]
> >>         # Left padding with blank:
> >>         $padded = sprintf( "%${pad_len}s", $text ) ;
> >> 
> >>         # Right padding with blank:
> >>         $padded = sprintf( "%${pad_len}s", $text ) ;
> > 
> > I must confess I fail to see the difference between those two bits of
> > code. Can anyone else enlighten me?
> 
> Its that cunning invisible minus sign in the second ;-}

No -- it's invisible in the first.  The second doesn't have any.

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


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

Date: 26 Apr 1999 18:47:23 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: FAQ 4.31: How do I pad a string with blanks or pad a number with zeroes?
Message-Id: <x7iuaj9eys.fsf@home.sysarch.com>

>>>>> "JS" == Jonathan Stowe <gellyfish@gellyfish.com> writes:

  JS> On Mon, 26 Apr 1999 10:59:26 +0200 Philip 'Yes, that's my address' Newton wrote:
  >> Tom Christiansen wrote:
  >>> 
  >>> (This excerpt from perlfaq4 - Data Manipulation
  >>> ($Revision: 1.46 $, $Date: 1999/04/20 18:59:53 $)
  >> [...]
  >>> # Left padding with blank:
  >>> $padded = sprintf( "%${pad_len}s", $text ) ;
  >>> 
  >>> # Right padding with blank:
  >>> $padded = sprintf( "%${pad_len}s", $text ) ;
  >> 
  >> I must confess I fail to see the difference between those two bits of
  >> code. Can anyone else enlighten me?
  >> 

  JS> Its that cunning invisible minus sign in the second ;-}

my bad. i am the author of that faq and i skipped the -! and no one
proofed it enough to find that until now.

:-(

these auto posts of the faq's are useful!

so tom, gnat, please amend that line to be:

Right padding with blank:

$padded = sprintf( "%-${pad_len}s", $text ) ;

in fact some of the english is buggy and should be edited. i will send
gnat a new version soon.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Mon, 26 Apr 1999 22:05:53 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: FAQ 4.54: What happens if I add or remove keys from a hash while iterating over it?  
Message-Id: <FAtHDt.Kp9@news.boeing.com>

In article <37244091@cs.colorado.edu>,
Tom Christiansen  <perlfaq-suggestions@perl.com> wrote:
>
>  What happens if I add or remove keys from a hash while iterating over it?
>
>    Don't do that.


I thought removal was safe... here's Larry circa 1995: 

   In Perl 4, you were not allowed to modify a hash at all
   while interating over it. In Perl 5 you can delete from
   it, but you still can't add to it, because that might
   cause a doubling of the hash table, in which half the
   entries get copied up to the new top half of the table,
   at which point you've totally bamboozled the interator
   code. Even if the table doesn't double, there's no 
   telling whether your new entry will be inserted before 
   or after the current iterator position.

   Either treasure up your changes and make them after the
   iterator finishes, or use keys to fetch all the old keys
   at once, and iterate over the list of keys.


--
Charles DeRykus


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

Date: Mon, 26 Apr 1999 16:09:51 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 7.19: Why doesn't "my($foo) = E<lt>FILEE<gt>;" work right?
Message-Id: <3724F23F.EFEDE2AA@mail.cor.epa.gov>

John Stanley wrote:
> 
> In article <3723dd32@cs.colorado.edu>,
> Tom Christiansen  <perlfaq-suggestions@perl.com> wrote:
> 
> onyx 101: perl /dev/tty
> my($foo) = E<lt>FILEE<gt>;
> syntax error at /dev/tty line 1, near "<lt"
> 
> Since the Subject is the question being answered, please repost this
> article with the correct subject.

I believe that *is* the correct subject line.  The entities just
haven't been translated.

BTW John, you're just a couple blocks away, oddly enough.  Still in
Burt Hall?

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Mon, 26 Apr 1999 18:37:27 -0400
From: Pierre-Luc <selectthree@gsig-net.qc.ca>
Subject: Re: Free Web Hosting with CGI
Message-Id: <3724EAA5.95AA22E8@gsig-net.qc.ca>

Yes there is one : Hypermart (http://www.hypermart.net).

They give you 10MB, full CGI access, it's fast and free.

The default is that you have to put a banner on each of your pages.

Paul A. Fortin wrote:

> Is there a site out there that allows CGI hosting and that is free.
> I've tried "webjump" but they severely limit what you can do in a script
> and it has become an irritant?
>
> Thanks for the help in advance.
>
> Paul A. Fortin



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

Date: 26 Apr 1999 22:26:03 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to ftp in perl?
Message-Id: <7g2p5r$4rp$1@gellyfish.btinternet.com>

On Mon, 26 Apr 1999 17:18:32 GMT mr_potato_head@my-dejanews.com wrote:
> Hi,	I need to ftp a file on a daily basis from one unix server to a
> novell server and I would like to do this ftp in perl.	Does anyone have a
> short hack to show me how to do this???  Thanks in advance...
> 

Get the Net::FTP module (part of the libnet bundle ) from CPAN and read
the documentation.  Alternatively you might look at someway of mounting
some partition on one or other of your server on the other - isnt NFS
available on Netware nowadays ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 26 Apr 1999 18:19:00 -0500
From: Andy Lee <andylee@prodigy.net>
Subject: Insert "\n"
Message-Id: <3724F464.A3C24147@prodigy.net>

All,
   I am writing a script to read a large file each line is contain more
than 250 characters and reformat to 60 characters on each line. How can
I insert the "\n" on the 60th character? Thanks.

AndyL





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

Date: Mon, 26 Apr 1999 23:35:12 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Insert "\n"
Message-Id: <7g2sn2$fpu$1@holly.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
Andy Lee <andylee@prodigy.net> wrote:
>All,
>   I am writing a script to read a large file each line is contain more
>than 250 characters and reformat to 60 characters on each line. How can
>I insert the "\n" on the 60th character? Thanks.

Been there, done that.

You can screw everything up with substr like I did or you can just use 
the Text::Wrap module like I do.


Good luck,



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

Date: Mon, 26 Apr 1999 23:11:16 GMT
From: brad_doctor@my-dejanews.com
Subject: Re: IPC left overs
Message-Id: <7g2rqg$bot$1@nnrp1.dejanews.com>

If this is linux, the command ipcrm will work.  For example:

ipcrm shm <id>
ipcrm msg <id>
ipcrm sem <id>

-brad

In article <7f2k1n$jt4$1@nnrp1.dejanews.com>,
  ryanpc@hotbot.com wrote:
> hello:
>
>   so i got this program that uses shared memory via IPC::Shareable calls to
> store results of HTTP requests.  i am ending up with a lot of "orphaned" IPC
> shared memory segments and semaphores.	after running the script eery minute
> for 12 hours i run "ipcs" from the command line and see a list of about
> twenty shared mem. segments and semaphores created by processes that are long
> since dead.  occasionaly, also, the script will fail to run via cron due to
> this error:
>
> semget returned undef: No space left on device at /home/ryan/cgi/wps/wps line
> 219
>
>    ...which i am attributing to memspace since disk space is fine.
>
> is there a way of "killing" these orphaned segments/semaphores?  are they
> even a problem (ie does solaris reclaim that space if PID is not running?)
>
> any direction/suggestion/thoughts given would be lovely
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 26 Apr 1999 15:25:31 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Limit 10 matches to display on screen
Message-Id: <m1lnffow84.fsf@halfdome.holdit.com>

>>>>> "gtan" == gtan  <00224166@bigred.unl.edu> writes:

gtan> The results i get from pressing the Next 10 results is always the same
gtan> as the first 10 results display on frist page.  Can anybody tell me how
gtan> should i modify the next page subroutine so it won't display the same
gtan> results everytime.

Presuming that's a CGI script, you should look at my WT column #2 at

	http://www.stonehenge.com/merlyn/WebTechniques/

which talks about how to "page through" the answers to a long
response.

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 26 Apr 1999 22:17:39 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: Multiline comments in perl
Message-Id: <slrn7i9pg2.2k8.eric@plum.fruitcom.com>

/* possible? */

-- 
Eric Smith
<eric@fruitcom.com> 
Tel. 021 236 111


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

Date: 26 Apr 1999 23:18:56 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Multiline comments in perl
Message-Id: <7g2s90$567$1@gellyfish.btinternet.com>

On 26 Apr 1999 22:17:39 GMT Eric Smith wrote:
> /* possible? */
> 

Ironically and perhaps unfortunately for you Tom's posting of the FAQ
item on this appears immediately above yours in my newsreader - of course
due to the nature of Network news it may not even have appeared on yours
yet.  However the article has a Subject that starts "FAQ 7.26" ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 26 Apr 1999 16:03:02 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: eric@fruitcom.com
Subject: Re: Multiline comments in perl
Message-Id: <3724F0A6.4697F872@atrieva.com>

Eric Smith wrote:
> 
> /* possible? */

It's in the FAQ.  It will tell you to use POD markup to accomplish the
same thing.  I find it a very unsatisfactory solution.

Ye Gods!  Why has thou forsaken C-style comments?!!!
  
-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Mon, 26 Apr 1999 16:51:34 -0700
From: Draco Paladin <paladin@uvic.ca>
To: Eric Smith <eric@fruitcom.com>
Subject: Re: Multiline comments in perl
Message-Id: <Pine.A41.4.05.9904261650310.54092-100000@unix4.UVic.CA>

On 26 Apr 1999, Eric Smith wrote:

> /* possible? */
> 

# Yes,
# It's possible.
# Quite simple really.
# :)

-- 
Mother is the name for GOD on the lips and
hearts of all children.  - Eric Draven



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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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