[16807] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4219 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 4 06:05:41 2000

Date: Mon, 4 Sep 2000 03:05:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <968061920-v9-i4219@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 4 Sep 2000     Volume: 9 Number: 4219

Today's topics:
    Re: $LIST_SEPARATOR bug?? <lr@hpl.hp.com>
    Re: $LIST_SEPARATOR bug?? <elephant@squirrelgroup.com>
    Re: A Challenge (Gwyn Judd)
    Re: A Challenge <randy_734@my-deja.com>
        ActivePerl / IIS incomplete set of headers <zuf@forrest.cz>
        ANNOUNCE: System::Index v0.1 <jdb@wcoil.com>
        Date format pularis@my-deja.com
    Re: Date format <elephant@squirrelgroup.com>
    Re: Date format <bcaligari@my-deja.com>
    Re: Date format <lr@hpl.hp.com>
    Re: Date format (Martien Verbruggen)
    Re: Date format <elephant@squirrelgroup.com>
    Re: Date format <godzilla@stomp.stomp.tokyo>
    Re: Date format <elephant@squirrelgroup.com>
    Re: hello world? (David H. Adler)
        HELP with WWWBoard Script natsurfer@my-deja.com
    Re: HELP with WWWBoard Script <mtaylorlrim@my-deja.com>
        How to delete line #1 <megrimes@flash.net>
    Re: How to delete line #1 <elephant@squirrelgroup.com>
    Re: How to truncate file after nth occurrence of string <anmcguire@ce.mediaone.net>
        Inserting todays date appsman1368@my-deja.com
    Re: Newbie of Regexp: How to extract the text between < <elephant@squirrelgroup.com>
    Re: Self-extracting program (Keith Calvert Ivey)
        Simple question - referencing array elements <randy_734@my-deja.com>
    Re: Simple question - referencing array elements <wyzelli@yahoo.com>
    Re: Simple question - referencing array elements <wyzelli@yahoo.com>
    Re: Simple question - referencing array elements <elephant@squirrelgroup.com>
    Re: Simple question - referencing array elements <anmcguire@ce.mediaone.net>
    Re: Sony Versus Microsoft <nickco3@yahoo.co.uk>
    Re: THE BEST solution to encode Strings after a 3DES cr <Peter.Dintelmann@dresdner-bank.com>
    Re: THE BEST solution to encode Strings after a 3DES cr <bart.lateur@skynet.be>
    Re: using VC++ to install modules <randy@theory.uwinnipeg.ca>
        waitpid <Joshua.Levy@nortel-dasa.de>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 3 Sep 2000 22:22:44 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: $LIST_SEPARATOR bug??
Message-Id: <MPG.141cd1828e481c4498ad1b@nntp.hpl.hp.com>

In article <MPG.141db78680d3e29c989758@localhost>, 
elephant@squirrelgroup.com says...
> Keith Calvert Ivey <kcivey@cpcug.org> wrote ..
> >jason <elephant@squirrelgroup.com> wrote:

 ...

> >>!     while ($text =~ s/"([^"]*)"/\x93$1\x94/sg) {};

 ...

>      $$quote = 1 if $text =~ s/"/``/s;

Just an observation about your persistent use of the /s modifier on 
regexes that don't contain the '.' metacharacter.  It doesn't affect the 
operation of the regex, but it affects readers trying to understand when 
they need to use /s and when they don't. 

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


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

Date: Mon, 04 Sep 2000 06:45:34 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: $LIST_SEPARATOR bug??
Message-Id: <MPG.141dd3d8b4dd89aa98975f@localhost>

Larry Rosler <lr@hpl.hp.com> wrote ..
>In article <MPG.141db78680d3e29c989758@localhost>, 
>elephant@squirrelgroup.com says...
>> Keith Calvert Ivey <kcivey@cpcug.org> wrote ..
>> >jason <elephant@squirrelgroup.com> wrote:
>
>...
>
>> >>!     while ($text =~ s/"([^"]*)"/\x93$1\x94/sg) {};
>
>...
>
>>      $$quote = 1 if $text =~ s/"/``/s;
>
>Just an observation about your persistent use of the /s modifier on 
>regexes that don't contain the '.' metacharacter.  It doesn't affect the 
>operation of the regex, but it affects readers trying to understand when 
>they need to use /s and when they don't. 

good comments for any beginner who's confused and reading the code in 
this thread as some sort of example of how to program

I'm not sure whether you're talking to Keith or to me ? .. in the latter 
case .. I never use the 's' modifier unless it has been explicitly 
required

perhaps I can shed some context on these regexes for you and for any 
other confused observer

all code that has been shown in this thread has come from Pod::Html .. 
none of it is an example of how to write good Perl code (despite the 
fact that Pod::Html has Tom C listed as it's author)

I purposely do not look at the quality of code in modules that I'm 
debugging - otherwise I'd be there all day

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 04 Sep 2000 05:08:12 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: A Challenge
Message-Id: <slrn8r6bhq.5d2.tjla@thislove.dyndns.org>

I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
say such a terrible thing:
>In article <9205rssmbg6g53m5goha4cvhb9qari0djf@4ax.com>,
>James Bond  <got1toomany@trojans.com> wrote:
>>I came accross the following script. It was essentially designed to
>>display the contents of a directory on a web page. The writer said
>>he designed it for an ftp site.
>>
>>Although I like the script as is, I can't do what I really want with
>>it. I'd like to be able to display the contents of multiple dirs.
>>
>>I'm new to perl (not a programmer by any stretch), and I've tried
>>anything I can think of. I always end up killing the script, or only
>>seeing the contents of one dir.
>
>I have a challenge too.  You see, I have some noodles, several cheeses,
>some tomatoes, some ground beef, and various spices sitting here in my
>kitchen, but I don't know how to cook.  So, I was wondering if some
>bright young chef would like to come over and cook me a lasagna.

here:

#!/usr/bin/perl -w
use strict;
use Telephony::Telephone;

my $telephone = new Telephony::Telephone;

$telephone->dial('1-800-PIZZA');

print $telephone <<END_OF_CALL;
Mushrooms
Olives
Pepperoni
Coke
END_OF_CALL

# yeah I know it's not lasagne

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
   :XOFF: /X-of/ n.  Syn. {control-S}.
From "The New Hackers Dictionary", version 4.2


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

Date: Mon, 04 Sep 2000 09:24:44 GMT
From: Randy <randy_734@my-deja.com>
Subject: Re: A Challenge
Message-Id: <39b367dd.16523000@207.126.101.100>

Dear Mr. Judd,

I would like to thank you for your excellent program. I ran it earlier
this evening and the pizza arrived about 30 minutes later. Would you
by chance be willing to write another program that can be used for
ordering ribs?

Respectfully Yours


tjla@guvfybir.qlaqaf.bet (Gwyn Judd) wrote:

>here:
>
>#!/usr/bin/perl -w
>use strict;
>use Telephony::Telephone;
>
>my $telephone = new Telephony::Telephone;
>
>$telephone->dial('1-800-PIZZA');
>
>print $telephone <<END_OF_CALL;
>Mushrooms
>Olives
>Pepperoni
>Coke
>END_OF_CALL
>
># yeah I know it's not lasagne
>
>-- 
>Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
>   :XOFF: /X-of/ n.  Syn. {control-S}.
>From "The New Hackers Dictionary", version 4.2



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

Date: Mon, 04 Sep 2000 11:40:40 +0200
From: Lubor Zoufal <zuf@forrest.cz>
Subject: ActivePerl / IIS incomplete set of headers
Message-Id: <39B36E18.B3B35AAD@forrest.cz>

Hi,
I have a problem running Perl CGIs on IIS server with ActivePerl. I get
an error APP did not return a complete set of header @INC contains only
perl/lib ,... It doesn't return current script directory. I have read
somewhere there is some additional configuration needed, but...

    Thanks

            Lubor Zoufal



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

Date: 4 Sep 2000 05:06:22 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: ANNOUNCE: System::Index v0.1
Message-Id: <8ovake$dsn$0@206.230.71.62>

Greetings Perlfolk,

Announcing the release of System::Index, version 0.1

It is available for download from: (**recomended URL**):
        http://www.josiah.countystart.com/modules/get.pl?sysidx:clp.misc

System::Index has also entered the CPAN as:
    file: $CPAN/authors/id/J/JB/JBRYAN/System-Index-0.1.zip
    size: 4049 bytes

** SYNOPSIS

 use System::Index;
 my $cpu_load = cpu_index();    # Averages 0.120 on my system, 'light' load
 my $mem_load = mem_index();    # Averages 0.88 on my system, 'light' load
 my $hd_load = hd_index();      # Averages 0.250 on my system, 'light' load

** VERSION

This is Version 0.1 ($Id: System::Index.pm, v0.1 2000/04/09 12:27:05 josiah
Exp $).

** DESCRIPTION

This is a simple load-measure for memory, CPU, and hard-disk access. It
requires
Benchmark and Export. It measures the load with a simple timethis()
benchmark loop
with a few stat functions thrown in for good measure.

** CLOSING

Regards,

        ~ Josiah Bryan, <jdb@wcoil.com>

Latest Version:

        http://www.josiah.countystart.com/modules/get.pl?sysidx:clp.misc-

--
Josiah Bryan
VP of Product Development
TDCJ, Inc.
"Anything is possible."

vp@tdcj.com
http://www.josiah.countystart.com/

Tel: 937.316.6256






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

Date: Mon, 04 Sep 2000 04:34:19 GMT
From: pularis@my-deja.com
Subject: Date format
Message-Id: <8ov8ob$qqs$1@nnrp1.deja.com>



 What should I use on a windows machine to get a formatted date
outpur ?. I used localtime() to get something like  Sun Sep 3 23:58:20
2000 . What I need has to be of the
09_03_00 format. I dont need the time , just the date. thx


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 04 Sep 2000 05:22:10 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Date format
Message-Id: <MPG.141dcef943c0b33c98975d@localhost>

pularis@my-deja.com <pularis@my-deja.com> wrote ..
> What should I use on a windows machine to get a formatted date
>outpur ?. I used localtime() to get something like  Sun Sep 3 23:58:20
>2000 . What I need has to be of the
>09_03_00 format. I dont need the time , just the date. thx

my recommendation is to use localtime in a list format .. and then 
output the values via printf

  perldoc -f localtime
  perldoc -f printf

don't forget to add 1900 to the year and to increment the month by 1 .. 
read the localtime documentation closely for why

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 04 Sep 2000 05:35:10 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: Date format
Message-Id: <8ovcad$uae$1@nnrp1.deja.com>

In article <8ov8ob$qqs$1@nnrp1.deja.com>,
  pularis@my-deja.com wrote:
>
>
>  What should I use on a windows machine to get a formatted date
> outpur ?. I used localtime() to get something like  Sun Sep 3 23:58:20
> 2000 . What I need has to be of the
> 09_03_00 format. I dont need the time , just the date. thx
>

my $datestamp;
{
	my($dd, $mm, $yy) = ((localtime())[3..5]);
	$dateStamp = sprintf("%02d_%02d_%02d", $dd, ($mm+1), ($yy -
100));
}
print("Today's date is: $dateStamp\n");

Check out:
http://www.cpan.org/doc/manual/html/pod/perlfunc/localtime.html

Brendon
++++


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 3 Sep 2000 23:06:01 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Date format
Message-Id: <MPG.141cdb9a27bd5ed398ad1c@nntp.hpl.hp.com>

In article <8ov8ob$qqs$1@nnrp1.deja.com>, pularis@my-deja.com says...
> 
>  What should I use on a windows machine to get a formatted date
> outpur ?. I used localtime() to get something like  Sun Sep 3 23:58:20
> 2000 . What I need has to be of the
> 09_03_00 format. I dont need the time , just the date. thx

Use localtime() in list context to get the components of the date, then 
sprintf() to format them.  Be sure to read the documentation of the 
localtime function.  At a command prompt, type:

    perldoc -f localtime

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


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

Date: Mon, 4 Sep 2000 17:12:26 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Date format
Message-Id: <slrn8r6faa.ucf.mgjv@martien.heliotrope.home>

On Mon, 04 Sep 2000 04:34:19 GMT,
	pularis@my-deja.com <pularis@my-deja.com> wrote:
> 
> 
>  What should I use on a windows machine to get a formatted date
> outpur ?. I used localtime() to get something like  Sun Sep 3 23:58:20
> 2000 . What I need has to be of the
> 09_03_00 format. I dont need the time , just the date. thx

I believe that on Windows boxes, the POSIX module is available for perl
nowadays[1]. In that case, you have the strftime function for all your data
formatting needs:

$date = strftime("%m_%d_%y", localtime);

# perldoc POSIX
look for strftime

Martien

[1] Activestate's online documentation states it's available for
Solaris, Linux and Windows.
-- 
Martien Verbruggen              | 
Interactive Media Division      | We are born naked, wet and hungry.
Commercial Dynamics Pty. Ltd.   | Then things get worse.
NSW, Australia                  | 


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

Date: Mon, 04 Sep 2000 06:53:45 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Date format
Message-Id: <MPG.141de472c14e6793989760@localhost>

Brendon Caligari <bcaligari@my-deja.com> wrote ..
>In article <8ov8ob$qqs$1@nnrp1.deja.com>,
>  pularis@my-deja.com wrote:
>>
>>
>>  What should I use on a windows machine to get a formatted date
>> outpur ?. I used localtime() to get something like  Sun Sep 3 23:58:20
>> 2000 . What I need has to be of the
>> 09_03_00 format. I dont need the time , just the date. thx
>>
>
>my $datestamp;
>{
>	my($dd, $mm, $yy) = ((localtime())[3..5]);
>	$dateStamp = sprintf("%02d_%02d_%02d"
>                          , $dd
>                          , ($mm+1)
>                          , ($yy - 100)
>                          );
>}
>print("Today's date is: $dateStamp\n");
>
>Check out:
>http://www.cpan.org/doc/manual/html/pod/perlfunc/localtime.html

well .. seeing as you quoted the documentation - I can only guess that 
you intentionally wrote in that y3k bug .. admittedly it's not for 
another 100 years .. but surely it deserves at least a warning !!

I have to ask though .. why do you have those two statements in a 
separate block ? .. and why not just use printf ?

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 04 Sep 2000 00:40:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Date format
Message-Id: <39B35206.B2F6E2DF@stomp.stomp.tokyo>

pularis@my-deja.com wrote:
 
> What should I use on a windows machine to get a 
> formatted date outpur ?. I used localtime() to 
> get something like  Sun Sep 3 23:58:20 2000 . 
> What I need has to be of the 09_03_00 format.
> I dont need the time , just the date. thx

*laughs*

Are you working hard at changing your writing style?

Here ya go. A nice variety of themes on time. I love
this kinda stuff. Sure beats the Hades out of oh so
stereotypical gag-me-with-a-spoon-boring Perl 5
Cargo Cult Mule Manure One Line Weenie Code.

Do whatever you like with this. Add arrays, remove
arrays, change formats, write time in easy-to-read
Egyptian Hieroglyphics, hmm, which is much like
Perl 5 Techno-Geekster code, yes?

*laughs again*

I posted something similar to this not quite
a year back, some of the geeks around back
then could not figure out how to get this
style of code to run on their machines.

** True Story **


Godzilla!
--
Most Common Referral At My Sites:
- Referral: 
  http://www.altavista.com/cgi-bin/query?q=callgirl+sex&kl=XX&pg=q&Translate=on



PRINTED RESULTS:
________________

Format One:
  Mon, Sep 04, 00:06 AM PST (-0800 GMT)

Format Two:
  00:06:37 9/04/2000

Format Three:
  9/04/2000 00:06:37

Format Four:
  9_04_2000

Format Five:
  09_04_2000

English Variant Choctaw:
  Monti - Siptimba 04 - 00:06 AM

True Choctaw Native Tongue:
  Nitak Hollotuk Onna - Hashi Hoponi 04 - 0:06 Nitak

English Literal Translation:
  Day After Holy Day - Cooking Month 04 - 0:06 Morning



TEST SCRIPT:
____________


#!/usr/local/bin/perl

print "Content-Type: text/plain\n\n";

  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
  my ($choctaw_hour) = $hour;
  my ($choctaw_hour2) = $hour;

  if ($sec < 10) 
   { $sec = "0$sec"; }
  if ($min < 10)
   { $min = "0$min";}
  if ($hour < 10)
   { $hour = "0$hour"; }
  if ($mon < 10)
   { $mon = "0$mon"; }
  if ($mday < 10)
   { $mday = "0$mday"; }

  my ($month) = ($mon + 1);
  my ($year) = ($year + 1900);
  my ($am_pm) = "AM";
  if ($hour > 12)
   { $hour = $hour - 12; $am_pm= "PM"; }

my $local_timezone = "PST (-0800 GMT)";
my (@day_of_week) = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
my (@month) = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", 
               "Sep", "Oct", "Nov", "Dec");


# format one:

$date = "$day_of_week[$wday], $month[$mon] $mday, $hour:$min $am_pm
$local_timezone";

print "Format One:\n  $date\n\n";


# format two:

$date = "$hour\:$min\:$sec $month/$mday/$year";

print "Format Two:\n  $date\n\n";


# format three:

$date = "$month/$mday/$year $hour\:$min\:$sec";

print "Format Three:\n  $date\n\n";


# format four:

print "Format Four:\n  ", $month, "_", $mday, "_", $year, "\n\n";


# format five:

if ($month < 10)
 { $month ="0$month"; }

print "Format Five:\n  ", $month, "_", $mday, "_", $year, "\n\n";


# in my native tongue, English Variant Choctaw:

@day_of_week = ("Nitak Hollo", "Monti", "Tusti", "Winsti",
                "Hlusti", "Flaiti", "Satate");
@month = ("Chanueli", "Febueli", "Macha", "Eplil", "Me", "Chuni",
          "Chuli", "Akas", "Siptimba", "Aktoba", "Nofimba", "Tisimba");

$date = "$day_of_week[$wday] - $month[$mon] $mday - $hour:$min $am_pm";
print "English Variant Choctaw:\n  $date\n\n";


# in my native tongue, True Choctaw:

$am_pm = "Nitak";

if ($choctaw_hour == 12)
 { $am_pm = "Tabokoli"; }
if ($choctaw_hour > 12)
 { $choctaw_hour = $choctaw_hour - 12; $am_pm = "Ninak"; }

@day_of_week = ("Nitak Hollo", "Nitak Hollotuk Onna", 
                "Nitak Hollotuk Imisha", 
                "Nitak Hollotuk Imisha Nitak Tuchina",
                "Nitak Hollotuk Imisha Nitak Usta", 
                "Nitak Hollotuk Imisha Tahlapi", 
                "Nitak Hollo Nakfish");

@month = ("Hashi Koi Nakfi Ushi", 
          "Hashi Watonlak", "Hashi Mahli", "Tik I Hashi", 
          "Hashi Bihi", "Hashi Bissa", "Hashi Kafi", 
          "Hashi Takkon", "Hashi Hoponi", "Hochafo Iskitini", 
          "Hochafo Chito", "Hashi Koi Chito");

$date = "$day_of_week[$wday] - $month[$mon] $mday - $choctaw_hour:$min $am_pm";

print "True Choctaw Native Tongue:\n  $date\n\n";


# English literal translation:

$am_pm = "Morning";

if ($choctaw_hour2 == 12)
 { $am_pm = "Noon"; }

if ($choctaw_hour2 > 12)
 { $choctaw_hour = $choctaw_hour2 - 12; $am_pm = "Night"; }

@day_of_week = ("Holy Day", "Day After Holy Day", "Second Day After Holy Day", 
                "Three Days After Holy Day", "Fourth Day After Holy Day", 
                "Fifth Day After Holy Day", "Holy Day's Brother");

@month = ("Lion's Little Brother Month", "Crane Month", "Wind Month", 
          "Woman's Month", "Mulberry Month", "Blackberry Month", 
          "Sassafras Month", "Peach Month", "Cooking Month", 
          "Little Hunger Month", "Big Hunger Month", "Big Lion Month");

$date = "$day_of_week[$wday] - $month[$mon] $mday - $choctaw_hour2:$min $am_pm";

print "English Literal Translation:\n  $date";


exit;


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

Date: Mon, 04 Sep 2000 09:09:57 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Date format
Message-Id: <MPG.141e045cd9dc1602989763@localhost>

Andrew N. McGuire  <anmcguire@ce.mediaone.net> wrote ..
>On Mon, 4 Sep 2000, jason quoth:
>
>~~ Date: Mon, 04 Sep 2000 06:53:45 GMT
>~~ From: jason <elephant@squirrelgroup.com>
>~~ Newsgroups: comp.lang.perl.misc
>~~ Subject: Re: Date format
>~~ 
>~~ Brendon Caligari <bcaligari@my-deja.com> wrote ..
>~~ >In article <8ov8ob$qqs$1@nnrp1.deja.com>,
>~~ >> 09_03_00 format. I dont need the time , just the date. thx
>
>[ snip ]
>
>~~ >my $datestamp;
>~~ >{
>~~ >	my($dd, $mm, $yy) = ((localtime())[3..5]);
>~~ >	$dateStamp = sprintf("%02d_%02d_%02d"
>~~ >                          , $dd
>~~ >                          , ($mm+1)
>~~ >                          , ($yy - 100)
>~~ >                          );
>~~ >}
>~~ >print("Today's date is: $dateStamp\n");
>
>[ snip ]
>
>~~ well .. seeing as you quoted the documentation - I can only guess that 
>~~ you intentionally wrote in that y3k bug .. admittedly it's not for 
>~~ another 100 years .. but surely it deserves at least a warning !!
>~~ 
>~~ I have to ask though .. why do you have those two statements in a 
>~~ separate block ? .. and why not just use printf ?
>
><pedantic>
>
>s~100~1000~;
>s~two~three~;
>
></pedantic>

actually s/y3k/y2.1k/

the 100 years was correct .. the stupid y3k was wrong (just too anxious 
to make a cute acronym thing)

basically the $yy-100 will work for 2000 up to 2099 .. but in 2100 $yy 
will be 200 and so $yy-100 will not work for a 2 digit date

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 4 Sep 2000 06:32:40 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: hello world?
Message-Id: <slrn8r6gg8.78l.dha@panix6.panix.com>

On 3 Sep 2000 19:24:34 -0500, Logan Shaw <logan@cs.utexas.edu> wrote:
>In article <8ou9s2$8tr$1@orpheus.gellyfish.com>,
>Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
>>On Sun, 03 Sep 2000 11:38:14 GMT Mark wrote:
>>> And here is one without using any modules. 
>>
>>And here is one without using Perl :
>>
>>#!/bin/sh
>>
>>echo 'Content-type: text/plain'
>>echo
>>echo 'Hello, World'
>
>And here's one without even using the shell:
>
>	#! /bin/sed 1,2d
>	
>	Content-type: text/plain
>	
>	Hello, World

And your perl comment is?

(*someone* had to say it... :-)

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
New Songs/New Members/New CD/Same rotten attitude
    - Raving Noah press release


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

Date: Mon, 04 Sep 2000 09:22:13 GMT
From: natsurfer@my-deja.com
Subject: HELP with WWWBoard Script
Message-Id: <8ovpjt$c8k$1@nnrp1.deja.com>

Hi folks,
I'm running a WWWBoard script on my Site. Every time a visitor posts a
message the script writes it in a new file and saves it in messages
directory. What do I have to change in the newfile subroutine (below)
to make the script use my Background image and font style/size/color
for these automatically generated pages??

Part of the Script:

#####################
# New File Subroutine

sub new_file {

   open(NEWFILE,">$basedir/$mesgdir/$num\.$ext") || die $!;
   print NEWFILE "<html>\n";
   print NEWFILE "  <head>\n";
   print NEWFILE "    <title>$subject</title>\n";
   print NEWFILE "  </head>\n";
   print NEWFILE "  <body>\n";
   print NEWFILE "    <center>\n";
   print NEWFILE "      <h1>$subject</h1>\n";
   print NEWFILE "    </center>\n";
   print NEWFILE "<hr size=7 width=75%>\n";
   if ($show_faq == 1) {

Any help will be appreciated
Thanks a lot!
Marc

btw: the WWWBoard can be found at www.natalie-imbruglia.ch


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 04 Sep 2000 09:31:16 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: HELP with WWWBoard Script
Message-Id: <8ovq54$cqu$1@nnrp1.deja.com>

Edit print NEWFILE "  <body>\n";
to:
print NEWFILE "  <body
background=\"http://domain.com/path/to/image.gif\">\n";


Mark

In article <8ovpjt$c8k$1@nnrp1.deja.com>,
  natsurfer@my-deja.com wrote:
> Hi folks,
> I'm running a WWWBoard script on my Site. Every time a visitor posts a
> message the script writes it in a new file and saves it in messages
> directory. What do I have to change in the newfile subroutine (below)
> to make the script use my Background image and font style/size/color
> for these automatically generated pages??
>
> Part of the Script:
>
> #####################
> # New File Subroutine
>
> sub new_file {
>
>    open(NEWFILE,">$basedir/$mesgdir/$num\.$ext") || die $!;
>    print NEWFILE "<html>\n";
>    print NEWFILE "  <head>\n";
>    print NEWFILE "    <title>$subject</title>\n";
>    print NEWFILE "  </head>\n";
>    print NEWFILE "  <body>\n";
>    print NEWFILE "    <center>\n";
>    print NEWFILE "      <h1>$subject</h1>\n";
>    print NEWFILE "    </center>\n";
>    print NEWFILE "<hr size=7 width=75%>\n";
>    if ($show_faq == 1) {
>
> Any help will be appreciated
> Thanks a lot!
> Marc
>
> btw: the WWWBoard can be found at www.natalie-imbruglia.ch
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 04 Sep 2000 06:09:43 GMT
From: "Mike Grimes" <megrimes@flash.net>
Subject: How to delete line #1
Message-Id: <H0Hs5.4543$qO1.379805@news.flash.net>

Howdy y'all,

I would like to delete the first line of a log file. Is there an expert who
could give me some advide on how I might accomplish this?

I open a file for reading and writing, read each line and perform some
operations then use seek to go back to the top of the file. Truncate deletes
from the first line on. How can I then delete just the first line?

Appreciate any help,
Mike




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

Date: Mon, 04 Sep 2000 06:55:46 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: How to delete line #1
Message-Id: <MPG.141de4ec198664d3989761@localhost>

Mike Grimes <megrimes@flash.net> wrote ..
>I would like to delete the first line of a log file. Is there an expert who
>could give me some advide on how I might accomplish this?

this is a FAQ .. perlfaq5: "How do I change one line in a file/delete a 
line in a file/insert a line in the middle of a file/append to the 
beginning of a file?"

I found it with this command on the command line

  perldoc -q "delete a line"

if you're not familiar with the perldoc tool then type the following for 
an explanation

  perldoc perldoc

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 4 Sep 2000 00:25:24 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: How to truncate file after nth occurrence of string
Message-Id: <Pine.LNX.4.21.0009040022300.2846-100000@hawk.ce.mediaone.net>

On Sun, 3 Sep 2000, Andrew N. McGuire  quoth:

~~ Date: Sun, 3 Sep 2000 21:26:15 -0500
~~ From: Andrew N. McGuire  <anmcguire@ce.mediaone.net>
~~ Newsgroups: comp.lang.perl.misc
~~ Subject: Re: How to truncate file after nth occurrence of string
~~ 
~~ On Sun, 3 Sep 2000, Bryan McAvoy quoth:
~~ 
~~ ~~ Date: Sun, 3 Sep 2000 03:24:04 -0400
~~ ~~ From: Bryan McAvoy <gustfrnt@globalvision.net>
~~ ~~ Newsgroups: comp.lang.perl.misc
~~ ~~ Subject: Re: How to truncate file after nth occurrence of string
~~ ~~ 
~~ ~~ Ouch. Well, thanks for setting me straight on how to ask the question. I
~~ ~~ guess what I asked didn't make a lot of sense. Anyway, let's try this again.
~~ ~~ 
~~ ~~ Here is a snippet of the log file from which I wish to grab the 5 most
~~ ~~ recent products. Products are appended to the beginning of the file
~~ ~~ (actually, since I'm not at work attm, I just pasted the same warning back
~~ ~~ to back, but this is what the log file looks like:
~~ 
~~ [ snip upside-down quoted godzilla reply ]
~~ 
~~ [ aside: only on Usenet can you say something like that. :-) ]
~~ 
~~ The following appears to satisfy you parameters, if I understand
~~ you correctly.
~~ 
~~ #!/usr/bin/perl -w 
~~ use strict;
~~ 

[ snip ]

~~ __DATA__

[ snip ]

~~ __END__

s~__END__~~;

Left '__END__' in there by accident, it is not needed, but won't hurt
in this case.  Sorry for not scrutinizing my example more before
posting it.

anm
-- 
Andrew N. McGuire
anmcguire@ce.mediaone.net
perl -le'print map?"(.*)"?&&($_=$1)&&s](\w+)]\u$1]g&&$_=>`perldoc -qj`'



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

Date: Mon, 04 Sep 2000 09:47:27 GMT
From: appsman1368@my-deja.com
Subject: Inserting todays date
Message-Id: <8ovr3d$dnr$1@nnrp1.deja.com>

I use Perls FORMAT facility to produce formatted hard-copy reports from
a database output file - with excellent results.

However, I now need to be able to print these reports to include
'todays' date.  I have tried using `date` but to no avail.  Has anyone
got any ideas please??

Thanks in advance


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 04 Sep 2000 04:52:28 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Newbie of Regexp: How to extract the text between <body> and </body>?
Message-Id: <MPG.141dba35d1b532c998975b@localhost>

jason <elephant@squirrelgroup.com> wrote ..
>Carfield Yim <carfield@programmer.net> wrote ..
>>As title, I originally think that it is very simple, like:
>>
>>$text = <web page text>;
>>$text = /<body>(.*?)<\/body>/img
>>
>>but turn out it not work, seen to me that it is the problem of
>>multi-line, so I change to
>
>you're correct - the above regex doesn't do what you want because of the 
>multi-line thing

hee hee .. AND because you're using an assignment operator so the search 
is being done on the contents of $_ which is probably not what you want 
 .. but it's all irrelevant because you should forget regex for this sort 
of problem because...

>you really need a parser .. have a look at HTML::Parser .. it's in the 
>standard distribution .. and it's very simple to use
>
>  perldoc HTML::Parser

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 04 Sep 2000 03:58:11 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Self-extracting program
Message-Id: <39bf1bb1.33226175@news.newsguy.com>

newsgroups@ckeith.clara.net (Colin Keith) wrote:

>But basically anything after __DATA__ (and before __END__) is 
>accessible via the filehandle DATA,

Reading from the DATA filehandle doesn't stop at the __END__
token -- it starts there if you're in package main, unless
there's a __DATA__ earlier (in which case __END__ is just
treated as part of the data that gets read).

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Mon, 04 Sep 2000 04:36:05 GMT
From: Randy <randy_734@my-deja.com>
Subject: Simple question - referencing array elements
Message-Id: <39b3254c.22592328@207.126.101.100>

How can I force Perl to return all the array elements?

For example:

@d=("One","Two","Three") ;

print @d ; result: OneTwoThree (what I want w/o a return)

print "@d\n" ;  Result: One Two Three  (unwanted spaces)

print @d."\n";  Result 3 (number of elements)

$r=@d ;
print $r ;   Result is number of elements

TIA for the help


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

Date: Mon, 4 Sep 2000 14:43:31 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Simple question - referencing array elements
Message-Id: <ScGs5.24$8x.1724@vic.nntp.telstra.net>

"Randy" <randy_734@my-deja.com> wrote in message
news:39b3254c.22592328@207.126.101.100...
> How can I force Perl to return all the array elements?
>
> For example:
>
> @d=("One","Two","Three") ;
>
> print @d ; result: OneTwoThree (what I want w/o a return)
>

Best I can figure from that description is that you want something like
this:

$r .= $_ for @d;

print $r;

Wyzelli




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

Date: Mon, 4 Sep 2000 14:46:46 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Simple question - referencing array elements
Message-Id: <mfGs5.25$8x.1783@vic.nntp.telstra.net>

"Randy" <randy_734@my-deja.com> wrote in message
news:39b3254c.22592328@207.126.101.100...
> How can I force Perl to return all the array elements?
>
> For example:
>
> @d=("One","Two","Three") ;
>
> print @d ; result: OneTwoThree (what I want w/o a return)
>

Or maybe this is really what you want :-

print @d,"\n";

Note the comma rather than the period.

Wyzelli




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

Date: Mon, 04 Sep 2000 05:30:31 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Simple question - referencing array elements
Message-Id: <MPG.141dd0ee41e022b498975e@localhost>

Randy <randy_734@my-deja.com> wrote ..
>How can I force Perl to return all the array elements?
>
>For example:
>
>@d=("One","Two","Three") ;
>
>print @d ; result: OneTwoThree (what I want w/o a return)

  print @d, "\n";

>print "@d\n" ;  Result: One Two Three  (unwanted spaces)
>
>print @d."\n";  Result 3 (number of elements)

this makes Perl treat @d in a scalar context and so you get the number 
of elements - not the elements themselves

but the @d, "\n" is just a list - and so @d is evaluated in list context 
and provides it's elements

you could also adjust the $" variable and then output @d within the 
double-quoted string (the value of $" governs what's put between the 
elements when they're in a double-quoted string)

  {
    local $";       # takes a local copy of $" and undefines it
    print "@d\n";
  }

  # because we localised $" it has now returned to whatever its
  # original value was before the above block

see the perlvar section of the manual for more information on $"

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 4 Sep 2000 00:55:33 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Simple question - referencing array elements
Message-Id: <Pine.LNX.4.21.0009040053580.2846-100000@hawk.ce.mediaone.net>

On Mon, 4 Sep 2000, Randy quoth:

~~ Date: Mon, 04 Sep 2000 04:36:05 GMT
~~ From: Randy <randy_734@my-deja.com>
~~ Newsgroups: comp.lang.perl.misc
~~ Subject: Simple question - referencing array elements
~~ 
~~ How can I force Perl to return all the array elements?
~~ 
~~ For example:
~~ 
~~ @d=("One","Two","Three") ;
~~ 
~~ print @d ; result: OneTwoThree (what I want w/o a return)

Is this what you want?

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

my @spectrum = qw
[ 
   red orange yellow green
   blue indigo violet
];

print @spectrum, "\n"


anm
-- 
Andrew N. McGuire
anmcguire@ce.mediaone.net
perl -le'print map?"(.*)"?&&($_=$1)&&s](\w+)]\u$1]g&&$_=>`perldoc -qj`'



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

Date: Mon, 04 Sep 2000 09:25:43 +0100
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Sony Versus Microsoft
Message-Id: <39B35C87.52EA5CC5@yahoo.co.uk>

"Godzilla!" wrote:

> After several years
> of searching our net, looking, watching, asking, I found no
> other programs like mine, not even attempts at what I have
> done with Perl ... living breathing
> highly intelligent androids most capable of Natural Language
> Emulation to a degree of ability to write fairly impressive
> poetry along with holding stimulating conversations with
> visitors, whom often accuse my androids of being either
> my daughter or myself. Actually they are my daughter.

What are you claiming here?
 - You've written a Perl script that passes the Turing test?
 - Your daughter is an android?
 - Your daughter is a Perl script?

Please learn to express yourself with less ambiguity.



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

Date: Mon, 4 Sep 2000 09:43:13 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: THE BEST solution to encode Strings after a 3DES crypt ?
Message-Id: <8ovjqb$kd01@intranews.bank.dresdner.net>

    Hi Tong,

Tong YANG schrieb in Nachricht <8oou3r$1ttj$1@news4.isdnet.net>...

    [snip]

>So, I search the perfect solution : I want to transmit the string in
>an numeric form, where each chars are converted to a number (hex or long).
>Each value of chars is separated by ":" for exemple.  So, I cannot
>find a Perl function to translate chars -> ascii value. I tried with

    ord() does what you want.

    To turn 'ABC' into '65:66:67' (the ascii values separated
    by ':') use

        $asciis = join ':', map ord, split '', 'ABC';

    Best regards,

        Peter Dintelmann





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

Date: Mon, 04 Sep 2000 08:46:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: THE BEST solution to encode Strings after a 3DES crypt ?
Message-Id: <fsn6rs431cpb0eh26h41i8id8j7eroqfek@4ax.com>

Dr. Peter Dintelmann wrote:

>>So, I cannot
>>find a Perl function to translate chars -> ascii value. I tried with
>
>    ord() does what you want.

As does unpack 'C', $char

>    To turn 'ABC' into '65:66:67' (the ascii values separated
>    by ':') use
>
>        $asciis = join ':', map ord, split '', 'ABC';

	$asciis = join ':', unpack 'C*', 'ABC';

Functionally equivalent, but it might be faster. Apparently, twice as
fast:

  use Benchmark;
  my $string = 'The quick brown fox jumps over the lazy dog.';
  timethese(10000, {
    'map ord split' => sub { my $asciis = join ':', map ord, split
      '', $string },
    'unpack C*' => sub { my $asciis = join ':', unpack 'C*', $string },
  });

-->
  Benchmark: timing 10000 iterations of map ord split, unpack C*...
  map ord split:  2 wallclock secs ( 2.20 usr +  0.00 sys =  2.20 CPU) @
  4545.45/s (n=10000)
  unpack C*:  1 wallclock secs ( 1.04 usr +  0.00 sys =  1.04 CPU) @
  9615.38/s (n=10000)

-- 
	Bart.


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

Date: Sun, 3 Sep 2000 23:42:17 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: using VC++ to install modules
Message-Id: <8ov9e2$pt4$1@canopus.cc.umanitoba.ca>

John Menke <john@eagleinfosystems.com> wrote
    in message news:39b31342_1@news.eclipse.net...
> randy,  I chose to take the CPAN route.... works great for the most part.
I
> do have one problem now.   The CPAN module is giving me this error when I
> try to install the Mail-Tools package:
>
> t\mailer............Use of uninitialized value in split at
> C:/.cpan/build/Mail
> ols-1.1401/blib/lib/Mail/Mailer.pm line 210.
> No mailer type specified (and no default available), thus can not find
> executable program. at t\mailer.t line 9
> t\mailer............dubious
[ ... ]

Hi,
   Chances are, since you're using ActivePerl, you may
be using an smtp server to send your mail. In the test
t\mailer.t of the package, you can specify the server as

$mail = new Mail::Mailer 'smtp', 'server' => 'server.name'

All the tests (should) then pass, although there's a
few warnings about uninitialized values in Mailer.pm.
These warnings can be ignored if you don't have
a mailer on your system, as they arise from line 210
of Mailer.pm in the sub is_exe, having to do with the
mailer command variable $exe not being defined.
Also, there's a warning in t\internet.t about an
uninitialized value; this can be gotten rid of by
setting your environment variable LOGNAME
to something.

best regards,
randy kobes





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

Date: Mon, 04 Sep 2000 11:04:59 +0200
From: "Levy, Joshua" <Joshua.Levy@nortel-dasa.de>
Subject: waitpid
Message-Id: <39B365BB.6B997CA7@nortel-dasa.de>

Hi

I am writing a cgi script which creates a csv database, I want to
implement a wait or waitpid so that the script waits for one filehandle
to be finnished writing before he lets another one do so (so that two
users do not write to the same line in the csv file). Can someone give
me a couple of examples to the syntax? I would appreciate it very much.

J.



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4219
**************************************


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