[22164] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4385 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 11 18:06:19 2003

Date: Sat, 11 Jan 2003 15:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 11 Jan 2003     Volume: 10 Number: 4385

Today's topics:
        formmail.pl strange output <bilkay@xxxlocalnet.com>
    Re: formmail.pl strange output <bongie@gmx.net>
    Re: How does one determine why perl prog runs so slow?? (Tony L. Svanstrom)
    Re: How does one determine why perl prog runs so slow?? (Tad McClellan)
    Re: How does one determine why perl prog runs so slow?? <penny1482@attbi.com>
    Re: How does one determine why perl prog runs so slow?? <uri@stemsystems.com>
    Re: How does one determine why perl prog runs so slow?? (Tony L. Svanstrom)
        how to print a hash <semaj_levram@worldnet.att.net>
    Re: how to redirect STDIN to such place like /dev/null  Andrew Lee
    Re: how to redirect STDIN to such place like /dev/null  (Tad McClellan)
    Re: how to redirect STDIN to such place like /dev/null  <bongie@gmx.net>
        I've never used the Win32::Daemon <mike@mainstreet-software.com>
    Re: muli-spaced fields and split() (bad_knee)
    Re: muli-spaced fields and split() (bad_knee)
    Re: Nested sort <mpapec@yahoo.com>
    Re: Nested sort (Tad McClellan)
    Re: Nested sort <bongie@gmx.net>
    Re: Nested sort <mpapec@yahoo.com>
    Re: Nested sort <mpapec@yahoo.com>
    Re: newline "\n" not working Andrew Lee
    Re: newline "\n" not working (Ben Morrow)
    Re: Pick First Occurance of duplicate data Andrew Lee
    Re: Picking out options in argv Andrew Lee
    Re: Picking out options in argv (Tony L. Svanstrom)
    Re: Picking out options in argv <bongie@gmx.net>
    Re: Proper attribution in follow-ups (Was Re: parsing x Andrew Lee
    Re: Proper attribution in follow-ups (Was Re: parsing x (Tad McClellan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 11 Jan 2003 14:50:17 -0500
From: "Bill K." <bilkay@xxxlocalnet.com>
Subject: formmail.pl strange output
Message-Id: <20030111.145016.1285228804.2465@xxxlocalnet.com>

I have a formmail.pl script, written by Matt Wright, on a website. I've
managed to get it to output error message pages, and what is really
strange is that the pages do not match what should be output by the error
subroutines. There are subtle differences in wording, but the most obvious
difference is that Matt Wright's copywrite notice is replaced by London
Perl Mongers', whose website (linked) claims to have replaced Matt's
poorly written scripts with more "professional" ones. I've looked through
the code fairly thoroughly and can't find anything that would reference
code outside the script. This isn't a big deal, as far as I can tell, but
it's had me scratching my head so much, I'm losing hair.
Can someone help me to put this to rest?

Bill K.


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

Date: Sat, 11 Jan 2003 22:10:44 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: formmail.pl strange output
Message-Id: <1291988.4ZopqyBtoI@nyoga.dubu.de>

Bill K. wrote:
> I have a formmail.pl script, written by Matt Wright, on a website.

Bad choice.

> I've managed to get it to output error message pages, and what is
> really strange is that the pages do not match what should be output by
> the error subroutines. There are subtle differences in wording, but
> the most obvious difference is that Matt Wright's copywrite notice is
> replaced by London Perl Mongers',

Good! :-)

> whose website (linked) claims to
> have replaced Matt's poorly written scripts with more "professional"
> ones.

That's right.  See http://nms-cgi.sourceforge.net/.

> I've looked through the code fairly thoroughly and can't find
> anything that would reference code outside the script. This isn't a
> big deal, as far as I can tell, but it's had me scratching my head so
> much, I'm losing hair. Can someone help me to put this to rest?

Probably your hoster already installed the nms script in /cgi-bin
(praise him ;-)), and you're accessing the wrong URL?  I'm only
guessing, though.

Ciao,
        Harald
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Computers make it easier to do a lot of things, but most of the things
they make it easier to do don't need to be done.
                        -- Andy Rooney


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

Date: Sat, 11 Jan 2003 20:05:34 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: How does one determine why perl prog runs so slow????
Message-Id: <1fon3rg.1ycft92p13djcN%tony@svanstrom.com>

<Andrew> wrote:

> On Sat, 11 Jan 2003 04:28:32 GMT, R.Mariotti@FinancialDataCorp.com
> (Bob Mariotti) wrote:
> 
> >Honestly!  I HAVE searched this group, other perl sites, perlfaqs, etc
> >and I cannot find anything that actually covers this topic.  It IS
> >perl so I'm posting in the perl group.
> >
> 
> 
> Did you try the web? I searched Goggle for "perl profiling" and got
> back 34,000 documents.

 You knew what to search for, he didn't... Try finding it without
knowing that it's called profiling!


-- 
# Per scientiam ad libertatem! // Through knowledge towards freedom! #
# Genom kunskap mot frihet! =*= (c) 1999-2002 tony@svanstrom.com =*= #

    perl -e'print$_{$_} for sort%_=`lynx -source svanstrom.com/t`'


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

Date: Sat, 11 Jan 2003 14:41:13 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How does one determine why perl prog runs so slow????
Message-Id: <slrnb210b9.kf.tadmc@magna.augustmail.com>

Feeling obligated to make no contribution at all the Abernathey Family <family2@aracnet.com> wrote:
> Feeling obligated to make a contribution to continue a 24x7 presense on
> this newsgroup Tad McClellan wrote:
>> 
>> Bob Mariotti <R.Mariotti@FinancialDataCorp.com> wrote:
>> > Honestly!  I HAVE searched this group, other perl sites, perlfaqs, etc
>> > and I cannot find anything that actually covers this topic.
>> 
>> You missed it then.


Bob looked for it. He wanted to see it. I told him where it was.

I helped him find what he wanted.


> Here's another classic perldoc -g lookie-here-for-nothing answers all
> too common on this newsgroup.


Here's another classic I-don't-answer-Perl-questions-I-only-whine
non-answer none too common (thankfully) on this newsgroup.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 11 Jan 2003 20:55:06 GMT
From: "Dick Penny" <penny1482@attbi.com>
Subject: Re: How does one determine why perl prog runs so slow????
Message-Id: <Kw%T9.645059$%m4.814438@rwcrnsc52.ops.asp.att.net>

Uri,
you are way off base here. I TOTALLY agree with the 'abernathey family'
response. I too have complained about the poor quality of Perl docs, and the
assumptions therein re a *nix background.

However, I have offered before, and I still offer, to help or write
revisions to the standard doc junk that comes with Perl, at least AS Perl.

Since I have not received one shred of interest, I feel obliged to 'whine' a
bit.

It is too bad, because when the Uri's and Tad's of the world choose to help,
they have been a great help. I encourage them to continue to do so.

Dick Penny
(quasi newbie)

"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7of6nfr7j.fsf@mail.sysarch.com...
> >>>>> "AF" == Abernathey Family <family2@aracnet.com> writes:
>
>   AF> Feeling obligated to make a contribution to continue a 24x7 presense
on
>   AF> this newsgroup Tad McClellan wrote:
>
> you are killfile material for that. i can here the plonks from all over
> the world.
>
>   >> perldoc -q profile
>   >>
>   >> "How do I profile my Perl programs?"
>   AF> --snip--
>
>   AF> Here's another classic perldoc -g lookie-here-for-nothing answers
all
>   AF> too common on this newsgroup.
>
> and here's another classic whine about references to the docs from
> someone who doesn't answer the OP themselves.
>
> you don't have the right to whine about an answer unless you provide
> better help yourself.
>
> and do you speak for your entire family? do your wife and kids concur
> with your whines? do they read the perl docs?
>
> uri
>
> --
> Uri Guttman  ------  uri@stemsystems.com  --------
http://www.stemsystems.com
> ----- Stem and Perl Development, Systems Architecture, Design and
Coding ----
> Search or Offer Perl Jobs  ----------------------------
http://jobs.perl.org
> Damian Conway Perl Classes - January 2003 --
http://www.stemsystems.com/class




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

Date: Sat, 11 Jan 2003 21:04:55 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: How does one determine why perl prog runs so slow????
Message-Id: <x7k7hbfle1.fsf@mail.sysarch.com>

>>>>> "DP" == Dick Penny <penny1482@attbi.com> writes:

  DP> you are way off base here. I TOTALLY agree with the 'abernathey
  DP> family' response. I too have complained about the poor quality of
  DP> Perl docs, and the assumptions therein re a *nix background.

on the other side, consider how many docs there are and how little of it
is actually unix centric. and almost all of the unix centric stuff is
derived from standard c libraries which are the same on most OS's. so
that claim is hollow. most of perl has little to do with the
OS. consider the flow control, data structures, operators, syntax, and
none of that is OS related. and what about all the modules that are OS
specific to systems other than unix?

  DP> However, I have offered before, and I still offer, to help or
  DP> write revisions to the standard doc junk that comes with Perl, at
  DP> least AS Perl.

so where are your changes? have you posted patches to p5p? this group is
not in control of the perl docs. we do have input to the FAQ (thanx to
bdf). so you can do whatever you want but whining about no one listening
is even less useful than the family's whine.

  DP> Since I have not received one shred of interest, I feel obliged to
  DP> 'whine' a bit.

obliged to whine? how does that come from no interest in your offer? i
don't think anyone is ever obliged to whine.

  DP> It is too bad, because when the Uri's and Tad's of the world
  DP> choose to help, they have been a great help. I encourage them to
  DP> continue to do so.

and when people who whine actually write docs or help instead, i would
encourage that too. i haven't seen any docs or diffs from you. join a
p5p and offer it there. the saying is 'patches welcome'.

and if you need to find p5p, go to lists.perl.org. 

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Sat, 11 Jan 2003 22:41:14 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: How does one determine why perl prog runs so slow????
Message-Id: <1fonagf.1ji5w4p1bizkd6N%tony@svanstrom.com>

Uri Guttman <uri@stemsystems.com> wrote:

> >>>>> "DP" == Dick Penny <penny1482@attbi.com> writes:

>   DP> However, I have offered before, and I still offer, to help or
>   DP> write revisions to the standard doc junk that comes with Perl, at
>   DP> least AS Perl.
> 
> so where are your changes? have you posted patches to p5p? this group is
> not in control of the perl docs. we do have input to the FAQ (thanx to
> bdf). so you can do whatever you want but whining about no one listening
> is even less useful than the family's whine.

 It's easy to know how it's done, but if you don't you might think that
people just aren't interested when you're saying that you're willing to
help...

 Just picture it yourself; you think that someone is going to turn up
saying "sure, I'm incharge, just rewrite the txt-files and send them to
me", but instead you end up having to learn what the heck a patch and
cvs and god(s of your choice)knowswhat is.


-- 
# Per scientiam ad libertatem! // Through knowledge towards freedom! #
# Genom kunskap mot frihet! =*= (c) 1999-2002 tony@svanstrom.com =*= #

    perl -e'print$_{$_} for sort%_=`lynx -source svanstrom.com/t`'


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

Date: Sat, 11 Jan 2003 22:20:54 GMT
From: "Jim Marvel" <semaj_levram@worldnet.att.net>
Subject: how to print a hash
Message-Id: <aN0U9.37882$p_6.3238165@bgtnsc04-news.ops.worldnet.att.net>

while (@fetched_row = $sth->fetchrow_array) {
        $record_num = shift @fetched_row;                                  #
storing the record's index here
        $records{$record_num} = \@fetched_row;                      # with
an eye to sorting these keys later
        print OUTFILE "record num = $record_num\tfetched row =
$records{$record_num}\n\n";
}



#using  module DBI with an Access database
     #the recordset is comprised of all records in a table
         #each record is an integer followed by other types of data
              #how do I print the hash instead of printing "ARRAY(stuff)"
---
thanks and sorry if this is a frequently-asked-question.
I hope that it is so simple that the time/energy that you expend in
reading/answering will be
more than recouped through the time/energy that is saved via re-application
of knowledge gained.
again,sorry

all criticism welcome!!!





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

Date: Sat, 11 Jan 2003 14:50:40 -0500
From: Andrew Lee
Subject: Re: how to redirect STDIN to such place like /dev/null ??
Message-Id: <rus02vst5c2tvu33gfp1c9auf5rs9h0ldm@4ax.com>

On Sun, 12 Jan 2003 02:46:26 +0800, "oooooops" <oooooops@163.com>
wrote:

>I set up a script for catching output of a pipe
>from aother program as following.
>but I can not close the STDIN
>or just redirect else behind double "\n"
>input. if I run it with
>$perl to_file.pl
>I have to type three time enter to end
>the script, but there is only two "\n"
>in the file catched. I am confused with it.
>
>could you give me some advice ??
>
>Thanks!!
>
>[test@mail test]$ less to_file.pl
>#!/usr/bin/perl -w
>
>use strict;
>
>my $i;
>open (DEST, ">>/home/test/testfile.dat")||die "$!";
>$i=0;
>OUTER: while (<STDIN>){
>        if ($_ eq "\n" && $i==1){
>#               close STDIN;
>                last OUTER;
>        }elsif($_ eq "\n" && $i==0){
>                $i=1;
>        }else{
>                $i=0;
>        }
>        print DEST $_;
>}
>close (DEST);
>

Eeek.   If you are looking for two newlines  -- just look for that :

while ( <STDIN> ) {
	last if /\n\n/;
}

That's all.

Your cose may be failing because $_ (the current line from STDIN)
doesn't eq "\n" ... but may contain "\n".  Have you tried :

while ( <STDIN> ) {
	print;
}

This will surely tell you what you are getting as input.






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

Date: Sat, 11 Jan 2003 14:28:32 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: how to redirect STDIN to such place like /dev/null ??
Message-Id: <slrnb20vjg.iu.tadmc@magna.augustmail.com>

Andrew Lee <AndrewLee> wrote:

> Eeek.   If you are looking for two newlines  -- just look for that :
> 
> while ( <STDIN> ) {
> 	last if /\n\n/;
> }


That pattern can never match.

The OP's program did not change the value of $/


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 11 Jan 2003 22:04:44 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: how to redirect STDIN to such place like /dev/null ??
Message-Id: <1273565.rHaFedXAPB@nyoga.dubu.de>

Andrew Lee wrote:
> Eeek.   If you are looking for two newlines  -- just look for that :
> 
> while ( <STDIN> ) {
>       last if /\n\n/;
> }
> 
> That's all.

You will have to alter $/ for this to work, or there will always be only
one \n in $_.
OTOH, maybe
        local $/="\n\n";
or
        local $/="";
is just what the OP might be looking for.

Ciao,
        Harald
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I'm a great lover, I'll bet.    -- Emo Phillips



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

Date: Sat, 11 Jan 2003 22:28:14 GMT
From: mike <mike@mainstreet-software.com>
Subject: I've never used the Win32::Daemon
Message-Id: <da612vkdn8jv9b9loro86kc26qodps8ujr@4ax.com>

I've never used the Win32::Daemon.

What I want to do is to be able to call some fairly simple Perl applications
routines.

Actually I have to convince the guy running our Win2000 server that we can call some
Perl routines from some server applications without causing too much trouble to the
rest of the server.

I want to be able to run some Robot and Lint type programs from a call from a browser
so that they can complete without being killed under a time-out.

Should I plan to start the daemon running and then use it for each such call, or
should I start and stop the daemon each time I kick off the called applications ?

Is there a way to use the daemon in this fashion ?

Does starting and stopping the daemon (or a given daemon) run into problems I don't
see yet ?

Mike
<mike@mainstreet-software.com>



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

Date: 11 Jan 2003 13:57:02 -0800
From: bl8n8r@yahoo.com (bad_knee)
Subject: Re: muli-spaced fields and split()
Message-Id: <e817ca4d.0301111357.74a38c5c@posting.google.com>

> Sorry, I've used d-option too much lately:
> 
> tr/ / /s;

That's what I was looking for. Thanks!


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

Date: 11 Jan 2003 14:05:27 -0800
From: bl8n8r@yahoo.com (bad_knee)
Subject: Re: muli-spaced fields and split()
Message-Id: <e817ca4d.0301111405.111fe1bc@posting.google.com>

> Show us your code thus far.  What do you want to extract from
> your logs?

It's at work right now.  I believe tr is what I was looking for.

Andre menioned split() is "implicit".  I think that means split()
automatically ignores the extra spaces.  This is odd.  I was on
Solaris coding the perl script, and noticed the problem with
the extra spaces throwing my field index off, however on linux,
this doesn't happen.  I need to take a closer look at my code.
The problem must lie elsewhere unless the two versions of perl
I'm using are different.

Thanks for reply anyhow!


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

Date: Sat, 11 Jan 2003 20:36:46 +0100
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: Nested sort
Message-Id: <chs02v08buijeb9g58forvl9pqchgbunir@4ax.com>

X-Ftn-To: John W. Krahn 

"John W. Krahn" <krahnj@acm.org> wrote:
>> fa99.5 1321.3 sr41_tr 45679.5 aa-wt test02
>> -----------------------------------------------------------------------------
>
>Here is one way to do it:
>
>$/ = '';  # set paragraph mode

This is ok but unfortunately fails to slurp the whole file when you have
"\n\n" in it(I learned this in a hard way :)). Thus, 

$/ = undef;

works in all scenarios. It would be even better to make it local and put
braces around our reading code:

{
  local $/ = undef;
  $text = <$fh>;
}

>open my $fh, '<', 'FileA' or die "Cannot open FileA $!";
^^^^^^^^^^^^

Is this supported under 5.005?



-- 
Matija


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

Date: Sat, 11 Jan 2003 14:35:24 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Nested sort
Message-Id: <slrnb2100c.iu.tadmc@magna.augustmail.com>

Matija Papec <mpapec@yahoo.com> wrote:
> "John W. Krahn" <krahnj@acm.org> wrote:
>>> fa99.5 1321.3 sr41_tr 45679.5 aa-wt test02

>>Here is one way to do it:
>>
>>$/ = '';  # set paragraph mode
> 
> This is ok but unfortunately fails to slurp the whole file when you have
> "\n\n" in it


John did not need or want to slurp the whole file.

If he did, he would have sorted a list with 1 element in it.


> (I learned this in a hard way :)). Thus, 
> 
> $/ = undef;
> 
> works in all scenarios. 


It does not work in _this_ scenario.

Sorting a list that has one element in it is not much of a challenge...


> It would be even better to make it local and put
> braces around our reading code:


Now that _is_ good advice.


> {
>   local $/ = undef;

   local $/;   # does the same thing

>   $text = <$fh>;
> }



-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 11 Jan 2003 21:47:19 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: Nested sort
Message-Id: <25440143.2RhXWsZMoi@nyoga.dubu.de>

Matija Papec wrote:
> "John W. Krahn" <krahnj@acm.org> wrote:
>>Here is one way to do it:
>>
>>$/ = '';  # set paragraph mode
> 
> This is ok but unfortunately fails to slurp the whole file when you
> have "\n\n" in it(I learned this in a hard way :)).

It is *not* intended to enable slurp mode here, and John correctly
commented the line with "paragraph mode".  That does exactly what you
describe: Split the file on two consecutive line breaks. 

> Thus,
> 
> $/ = undef;
> 
> works in all scenarios.

But not here.  It would break John's code.  Please look at it: It feeds
<$fh> to a map(), which now reads paragraph by paragraph.  (And sorting
by the paragraph headings is one thing that the OP is interested in.)

Ciao,
        Harald
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Interesting Error Messages #25:
ZAP! Process discontinued. Enter any 12-digit prime number to resume. 



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

Date: Sat, 11 Jan 2003 22:32:54 +0100
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: Nested sort
Message-Id: <68312vsri62i225vijpnqsao9q8arvhru5@4ax.com>

X-Ftn-To: Tad McClellan 

tadmc@augustmail.com (Tad McClellan) wrote:
>> This is ok but unfortunately fails to slurp the whole file when you have
>> "\n\n" in it
>
>John did not need or want to slurp the whole file.
>
>If he did, he would have sorted a list with 1 element in it.

Tnx, I wasn't careful enough.

>It does not work in _this_ scenario.
>
>Sorting a list that has one element in it is not much of a challenge...

Indeed. :)



-- 
Matija


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

Date: Sat, 11 Jan 2003 22:39:48 +0100
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: Nested sort
Message-Id: <od312v0nevks81b1dqu3jmafshfq6s6rhg@4ax.com>

X-Ftn-To: Harald H.-J. Bongartz 

"Harald H.-J. Bongartz" <bongie@gmx.net> wrote:
>> This is ok but unfortunately fails to slurp the whole file when you
>> have "\n\n" in it(I learned this in a hard way :)).
>
>It is *not* intended to enable slurp mode here, and John correctly
>commented the line with "paragraph mode".  That does exactly what you
>describe: 

Yes, it does; it's only that I have some trigger inside me, so when I see 
$/ = ''; it goes off and start flashing in red light. ;)

>> Thus,
>> 
>> $/ = undef;
>> 
>> works in all scenarios.
>
>But not here.  It would break John's code.  Please look at it: It feeds
><$fh> to a map(), which now reads paragraph by paragraph.  (And sorting
>by the paragraph headings is one thing that the OP is interested in.)



-- 
Matija


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

Date: Sat, 11 Jan 2003 14:07:13 -0500
From: Andrew Lee
Subject: Re: newline "\n" not working
Message-Id: <dmq02vct9goooegnpp3nbvnoovfqkg43iu@4ax.com>

On 10 Jan 2003 14:49:34 -0800, bazzz777@yahoo.com (bazzz777) wrote:

>I'm trying to write lines to a javascript file using the perl CGI module on Linux.
>
>The lines are written to the .js file with:
>
>open(file1,">>/tmp/$projectname");
>print file1 "$duedate\n";
>print file1 "$email\n";
>print file1 "$description\n";
>close(file1);

The newlines are there.  Apparently Perl knows how to print.

Maybe there is something else wrong??  Like the HTML tag that
indicated to a web browser to insert a line break is <br> and not
"\n".




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

Date: Sat, 11 Jan 2003 22:41:53 +0000 (UTC)
From: mauzo@mimosa.csv.warwick.ac.uk (Ben Morrow)
Subject: Re: newline "\n" not working
Message-Id: <avq6jh$oso$1@wisteria.csv.warwick.ac.uk>

mthunter@uiuc.edu wrote:
>On 10 Jan 2003 14:49:34 -0800, bazzz777 wrote:
>>  In MS Windows all the data appears as one long line.
>>  I can make the javascript web browser readable if I edit in newlines
>>  using a Windows text editor. 
>>  
>>  I also tried my CGI with "\r" instead of "\t" but
>
>I assume you meant "\n", not "\t", right?
>
>Did you try "\r\n"?

Better: "\cM\cJ", as this is more portable.

Ben


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

Date: Sat, 11 Jan 2003 14:21:22 -0500
From: Andrew Lee
Subject: Re: Pick First Occurance of duplicate data
Message-Id: <4sq02v8tk7iatlcu689c2vriscvp4fpovj@4ax.com>

On Sat, 11 Jan 2003 00:34:53 GMT, "Eric W. Holzapfel"
<eholz.one@verizon.net> wrote:

>Hello Perlies,
>
>I have a Perl script that reads an Apache log file.  I get the ip 
>address from the access_log file.
>There can be multiple entries with the same IP.  I would like to pick 
>the first occurrance (or just one) in a series of ip addresses that are 
>the same.  There can be, for example, 200 lines in the file, and the 
>same IP address can be on subsequent lines.  Lines 1 thru 33 can be 
>4.44.56.55, etc.  I would like to pick just on IP for multiple occurances.  
>
>How can I do this in Perl?

Whenever you want unique something in Perl, think "Hash keys."  If you
makes the IP addresses the keys of a hash that'll do the trick :

(untested)
my %IP_count;
my $line;
while (defined ($line = <FILE>)) {
	# I'll assume $line just contains a valid IP addr
	$IP_count{$line} == 1 ? next : $IP_count{$line}++;
	# make sure you understand why this line works
}

my @IP_addrs = keys %IP_count;

I assume each line only contains an IP address so that I don't have to
rewrite code for a regex that matches IP addresses (you may have
already done so yourself).

This is probably the best way to get the unique IP addresses because
it does not require sorting.  You will also find the idiom of using
hash keys to normalize data very useful.


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

Date: Sat, 11 Jan 2003 15:08:24 -0500
From: Andrew Lee
Subject: Re: Picking out options in argv
Message-Id: <b7u02v8a04ibn0ho28olnsml5om0sh4vj8@4ax.com>

On Sat, 11 Jan 2003 10:35:41 -0800, "John Tuong"
<starfury@cats.ucsc.edu> wrote:

>> Then process all of the switches with this simple loop:
>>
>>    while ( defined $ARG[0] and exists $todo{$ARG[0]} ) {
>>       my $arg = shift;
>>       $todo{$arg}->();      # execute the appropriate anon subroutine
>>    }
>
>This is a cool concept, I think I'll stick to this 1 because perldoc getopt
>doesn't yield any results.  

[snip]

try http://search.cpan.org ... perldoc won't find it if you didn't
install it  :-)


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

Date: Sat, 11 Jan 2003 20:44:26 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Picking out options in argv
Message-Id: <1fon5l4.jo8t4eaegvrsN%tony@svanstrom.com>

<Andrew> wrote:

> On Sat, 11 Jan 2003 10:35:41 -0800, "John Tuong"
> <starfury@cats.ucsc.edu> wrote:
> 
> >> Then process all of the switches with this simple loop:
> >>
> >>    while ( defined $ARG[0] and exists $todo{$ARG[0]} ) {
> >>       my $arg = shift;
> >>       $todo{$arg}->();      # execute the appropriate anon subroutine
> >>    }
> >
> >This is a cool concept, I think I'll stick to this 1 because perldoc getopt
> >doesn't yield any results.  
> 
> [snip]
> 
> try http://search.cpan.org ... perldoc won't find it if you didn't
> install it  :-)

 My lil friend scpan, something that just started as a quick hack to
start a google-search, but now I use it for several sites; one of these
days I'll rewrite it (somewhat) and put them all on a webpage. =)

#!/usr/bin/perl -w
# ©2002-2003 svanstrom.com
# <URL: http://www.svanstrom.com >

foreach (@ARGV) {$_ = "\"$_\"" if /\s/};

($q = "@ARGV") =~ s/([\W])/"%" . uc(sprintf("%2.2x",ord($1)))/eg;
$q = "http://search.cpan.org/search?q=$q";

if (! exists $ENV{REMOTEHOST} && $ENV{OSTYPE} eq 'darwin') {
        print <<'END'

I hope you'll find it! =)

        /tony@svanstrom.com
<URL: http://www.svanstrom.com/ >

END
;
        system('open',"$q");
} else {
        system("lynx", "$q");
        print <<'END'

I hope you found it! =)

        /tony@svanstrom.com
<URL: http://www.svanstrom.com/ >

END
;
}


-- 
# Per scientiam ad libertatem! // Through knowledge towards freedom! #
# Genom kunskap mot frihet! =*= (c) 1999-2002 tony@svanstrom.com =*= #

    perl -e'print$_{$_} for sort%_=`lynx -source svanstrom.com/t`'


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

Date: Sat, 11 Jan 2003 21:59:05 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: Picking out options in argv
Message-Id: <2288606.aLkcx2hlCE@nyoga.dubu.de>

Andrew Lee wrote:
> On Sat, 11 Jan 2003 10:35:41 -0800, "John Tuong"
> <starfury@cats.ucsc.edu> wrote:
>>This is a cool concept, I think I'll stick to this 1 because perldoc
>>getopt doesn't yield any results.

Yes, that's true, unfortunately.  Maybe we need an FAQ entry like "Does
Perl have something like the getopt() function?" or "How do I parse
command line options?"  But on the other hand, you can find it when
looking at "perldoc perlmodlib" or searching on CPAN.

> [snip]
> 
> try http://search.cpan.org ... perldoc won't find it if you didn't
> install it  :-)

Getopt::Long and Getopt::Std are part of the standard Perl distribution,
Getopt::Long at least since 5.6.0.

Ciao,
        Harald
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
No, I'm not going to explain it.  If you can't figure it out, you didn't
want to know anyway...  :-)
                -- Larry Wall in <1991Aug7.180856.2854@netlabs.com>



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

Date: Sat, 11 Jan 2003 14:13:57 -0500
From: Andrew Lee
Subject: Re: Proper attribution in follow-ups (Was Re: parsing xml with perl --- very urgent .. help please)
Message-Id: <97r02voisc0ru7ooo74u1l84jg0t8ln9cm@4ax.com>

On Fri, 10 Jan 2003 08:43:42 -0600, tadmc@augustmail.com (Tad
McClellan) wrote:

>Andrew Lee <AndrewLee> wrote:
>
>> Subject: Re: parsing xml with perl --- very urgent .. help please
>                                         ^^^^^^^^^^^    ^^^^^^^^^^^

Note: I was not the orginal poster.  That is not my subject line.
Please do not put words in my mouth.

Indeed there ought to be something in the posting guidelines about
proper attribution -- it is far more important (AFAIC) to _correctly_
quote your fellow netizens than to minimize the pleading on clpm.

I am certain you would agree.

-- Andrew




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

Date: Sat, 11 Jan 2003 14:17:35 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Proper attribution in follow-ups (Was Re: parsing xml with perl --- very urgent .. help please)
Message-Id: <slrnb20uuv.iu.tadmc@magna.augustmail.com>

Andrew Lee <AndrewLee> wrote:
> On Fri, 10 Jan 2003 08:43:42 -0600, tadmc@augustmail.com (Tad
> McClellan) wrote:
>>Andrew Lee <AndrewLee> wrote:
>>
>>> Subject: Re: parsing xml with perl --- very urgent .. help please
>>                                         ^^^^^^^^^^^    ^^^^^^^^^^^
> 
> Note: I was not the orginal poster.  That is not my subject line.
> Please do not put words in my mouth.


I made a mistake. Sorry.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4385
***************************************


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