[18290] in Perl-Users-Digest
Perl-Users Digest, Issue: 458 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 9 21:07:12 2001
Date: Fri, 9 Mar 2001 18:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984189908-v10-i458@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 9 Mar 2001 Volume: 10 Number: 458
Today's topics:
Re: (OFF TOPIC - IGNORE) Re: Hidden URL <godzilla@stomp.stomp.tokyo>
Re: (OFF TOPIC - IGNORE) Re: Hidden URL <bart.lateur@skynet.be>
Re: binary to decimal conversion: FAQ answer is not goo <krahnj@acm.org>
Re: binary to decimal conversion: FAQ answer is not goo (Martien Verbruggen)
Re: binary to decimal conversion: FAQ answer is not goo (Abigail)
GUID in Perl <hernux@etherac.com.ar>
Re: Help to Install Perl <dream1625@aol.com>
Re: Help to Install Perl <dream1625@aol.com>
How do I get the name of a variable as a string? <donotreply@interbulletin.bogus>
Re: How to get perl not to convert decimal character (Tim Hammerquist)
Re: Macbeth and Perl threads <micah@cowanbox.com>
Passing command line arguments to script <bmccann@naisp.net>
Perl download problem with default link <whataman@home.com>
Re: Perl download problem with default link <micah@cowanbox.com>
Problem with getline in Text::CVS_XS (Joe Brenner)
Re: Problem with getline in Text::CVS_XS (Joe Brenner)
Reading and Writing to Files <milliwave@rfengineering.freeserve.co.uk>
Re: Reading and Writing to Files <sorryno@email.at.all>
scalar(localtime) in reverse? <sorryno@email.at.all>
Re: scalar(localtime) in reverse? <bart.lateur@skynet.be>
Re: using Perl for B2B? <hermel_michaud@hotmail.com>
Re: Weekend woes?! (Abigail)
Re: Weekend woes?! <Jonathan.L.Ericson@jpl.nasa.gov>
Re: Weekend woes?! (Martien Verbruggen)
Re: Weekend woes?! <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 09 Mar 2001 15:11:37 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: (OFF TOPIC - IGNORE) Re: Hidden URL
Message-Id: <3AA96329.C7D45F96@stomp.stomp.tokyo>
Chris Stith wrote:
> Godzilla! wrote:
> > Miguel Cruz wrote:
> > (snippage not noted by Cruz - context not retained)
> > > Godzilla! wrote:
(snipped)
> A reference to a site should be qualified by the author
> to avoid confusion with an endoresment, even if it is
> unfair to assume endorsement by the reader. It is, after
> all, the author's responsibility to relay the information
> to the reader.
I don't do diapers.
Godzilla!
--
@ø=(a .. z);@Ø=qw(6 14 3 25 8 11 11 0 17 14 2 10 18);
$§="\n";$ß="\b";undef$©;print$§x($Ø[4]/2);
for($¡=0;$¡<=$Ø[2];$¡++){foreach$¶(@Ø){
$ø[$¶]=~tr/A-Z/a-z/;if(($¡==1)||($¡==$Ø[2]))
{$ø[$¶]=~tr/a-z/A-Z/;}print$ø[$¶];if($¶==0)
{print" ";}if($¶==$Ø[12]){print" !";}&D;}
print$ßx($Ø[4]*2);}print$§x($Ø[10]*2);
sub D{select$©,$©,$©,.25;}exit;
------------------------------
Date: Sat, 10 Mar 2001 01:41:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: (OFF TOPIC - IGNORE) Re: Hidden URL
Message-Id: <jj1jat0rpruqatn6c3sc6f6rdigqcl5mqs@4ax.com>
Godzilla! wrote:
>I don't do diapers.
Since you recently claimed to be pregnant, I think you'll have to get
used to them...
--
Bart.
------------------------------
Date: Fri, 09 Mar 2001 23:31:46 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: binary to decimal conversion: FAQ answer is not good
Message-Id: <3AA96955.3E6ACD02@acm.org>
Martien Verbruggen wrote:
>
> The ord and 'c' template indicate that you are working with characters.
> Normally, characters are 8 bytes long. You need to pick a length and
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is this a new ISO standard that I missed? :-)
> endianness you want to use in your calculations. I tend to use big
> endian, because in that case the leftmost bits in the string are most
> significant, and the rightmost least, and it's portable and available in
> pack. Other endiannesses have odder byte orderings. In this case I'll
> show you what you can do with an unsigned 32 bit integer:
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sat, 10 Mar 2001 12:36:29 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: binary to decimal conversion: FAQ answer is not good
Message-Id: <slrn9aj18t.uoe.mgjv@martien.heliotrope.home>
On Fri, 09 Mar 2001 23:31:46 GMT,
John W. Krahn <krahnj@acm.org> wrote:
> Martien Verbruggen wrote:
>>
>> The ord and 'c' template indicate that you are working with characters.
>> Normally, characters are 8 bytes long. You need to pick a length and
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Is this a new ISO standard that I missed? :-)
Ack..
s/bytes/bits/;
Martien
--
Martien Verbruggen |
Interactive Media Division | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd. | from a rich salesperson.
NSW, Australia |
------------------------------
Date: 10 Mar 2001 01:58:50 GMT
From: abigail@foad.org (Abigail)
Subject: Re: binary to decimal conversion: FAQ answer is not good
Message-Id: <slrn9aj2iq.asv.abigail@tsathoggua.rlyeh.net>
Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMDCCXLVIII
September MCMXCIII in <URL:news:slrn9aj18t.uoe.mgjv@martien.heliotrope.home>:
!! On Fri, 09 Mar 2001 23:31:46 GMT,
!! John W. Krahn <krahnj@acm.org> wrote:
!! > Martien Verbruggen wrote:
!! >>
!! >> The ord and 'c' template indicate that you are working with characters.
!! >> Normally, characters are 8 bytes long. You need to pick a length and
!! > ^^^^^^^^^^^^^^^^^^^^^^^^^^^
!! > Is this a new ISO standard that I missed? :-)
!!
!! Ack..
!!
!! s/bytes/bits/;
Oh, you didn't mean 8 one-bit bytes?
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
------------------------------
Date: Fri, 9 Mar 2001 20:26:51 -0300
From: "Hernux" <hernux@etherac.com.ar>
Subject: GUID in Perl
Message-Id: <98bp1o$9lm$1@taliesin.netcom.net.uk>
Anybody knows a good algorithm to create a Unique ID number for each
connection in perl?
------------------------------
Date: Fri, 09 Mar 2001 23:14:25 GMT
From: "Suzanne" <dream1625@aol.com>
Subject: Re: Help to Install Perl
Message-Id: <ltdq6.165689$B6.36878041@news1.rdc1.md.home.com>
Call me an unabashed noncomformist then .... c'est la vie!
__________________________________________
Suzanne @CampusTech
http://www.campustech.com Beta Site: http://campust.iserver.net/
Big Discounts on Software for Students & Teachers
Chris Stith <mischief@velma.motion.net> wrote in message
news:tai0ur3rf7o7f9@corp.supernews.com...
> Scott R. Godin <webmaster@webdragon.munge.net> wrote:
> > In article <%qKp6.161592$B6.36271990@news1.rdc1.md.home.com>, "Suzanne"
> > <sbucciarelli1@home.com> wrote:
>
> > [snip]
> > | accomplished. As for "top posting" ... not familiar with any
> > | particular etiquette ... if that means
> > [snip]
>
> > as for 'top-posting' here's some informational stuff you can peruse, as
> > to why it's bad form, bad nettiquette, wasteful of resources, and can
> > and will cause people to simply ignore your posts ( I kid you not )
>
> > This is akin to a "dress code" here and IS something that the perl
> > masters and gurus who post here will tend to insist on.
>
> > Top posting wouldn't even exist if some bright young and stupid
> > MicroSoft programmer hadn't written the app to use that as the 'default'
> > instead of following usenet convention for this purpose. (visualizing MS
> > inter-company e-mail, all top-posted and containing zillions of lines of
> > previous text that no one ever reads along with every single .sig of
> > every previous poster. and laughing.)
>
> I use tin, and it sues vi as its editor. vi starts at the top.
> I key down until I am where I need to type. The program does
> not control the user. A text editor has many keys to inform it
> of the user's wishes, including the ones in MS Office products.
>
> Failing to be aware that one should not show the sole of the
> foot to someone in certain parts of Africa, that a woman
> should be modestly dressed in an Arab country (even if not
> covered with a veil and all, at least not in a tube top and
> short skirt), or that one should not pass gas in a fine
> restaurant in America does not mean that these things are not
> rude. If you travel somewhere and are not familiar with the
> customs, it is your duty to learn the local customs and to
> conform to society. It is not society's duty to conform to
> your foreign ideas. When in Rome, do as the Romans. When
> posting to a newsgroup, post like a newsgroup poster.
>
> Chris
>
> --
> Christopher E. Stith
> You can never entirely stop being what you once were. That's
> why it's important to be the right person today, and not put
> it off till tomorrow. -- Larry Wall, 3rd State of the Onion
>
------------------------------
Date: Fri, 09 Mar 2001 23:21:06 GMT
From: "Suzanne" <dream1625@aol.com>
Subject: Re: Help to Install Perl
Message-Id: <Czdq6.165707$B6.36880930@news1.rdc1.md.home.com>
Of course I realize that .... the absurdity of the entire thread I also
realize ... the horrific waste of bandwidth also .... oooooh ... I asked
one question to the newsgroup .... it was answered immediately politely and
concisely ... then it was answered by net nazi who insists it is his
responsibility to make sure people toe the mark in his newsgroups .... well
... la ti da ... all that follows could have been avoided completely if only
he hadn't thought he needed to tell me what to do .... I don't care too much
for being told what to do by someone of dubious authority and that's that
... You could have all let the question be asked and answered easily and
that would be the end of it. That was the only Perl question I had or ever
anticipate having. But you all may go on and on and perhaps this thread
will never die. What the hell ... getting to know each other is such fun.
__________________________________________
Suzanne @CampusTech
http://www.campustech.com Beta Site: http://campust.iserver.net/
Big Discounts on Software for Students & Teachers
Scott R. Godin <webmaster@webdragon.munge.net> wrote in message
news:98bbmb$h2n$0@216.155.32.55...
> In article <2R1q6.163687$B6.36693885@news1.rdc1.md.home.com>, "Suzanne"
> <sbucciarelli1@home.com> wrote:
>
> | Perhaps you are a shut-in ... I am not. I have an account from
> | work, from AOL, from Mindspring and cable .... tsk tsk tsk .....
> | crime of the century
>
> You do realize it's just as easy if not easier for us to press the "next
> post" key as it is to dump someone in the killfile, and simply not
> bother responding to you at all..
>
> following up 'normally' is not at all difficult. I'm frankly rather
> surprised at your obtuseness. In any case, no water off my back.
>
> post->next();
>
> --
> unmunge e-mail here:
> #!perl -w
> print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
> # ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Fri, 09 Mar 2001 23:38:12 +0000
From: Prem <donotreply@interbulletin.bogus>
Subject: How do I get the name of a variable as a string?
Message-Id: <3AA96964.31B3974@interbulletin.com>
Hello,
Question: Is it possible to get the variable name as a string, if so how?
$myvar1str=GetVarNameAsString($myvar1);
# GetVarNameAsString should return "myvar1"
$myvar1str=GetVarNameAsString(@myvar2);
# GetVarNameAsString should returns "myvar2"
Any suggestins where I should start looking for the solution if I need to write the function "GetVarNameAsString". 'perl internals' or is there an easy solution?
Thanks in advance.
Prem
_______________________________________________
Submitted via WebNewsReader of http://www.interbulletin.com
------------------------------
Date: Fri, 09 Mar 2001 23:31:48 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: How to get perl not to convert decimal character
Message-Id: <slrn9aiq5m.hia.tim@vegeta.ath.cx>
Brian <dersgniw@fuse.net> wrote:
> "Chris Stith" <mischief@velma.motion.net> wrote...
> > The CGI or CGI::Lite modules will give you strings that are decoded
> > properly when you grab the forma data using them, and will encode
> > them properly when you get ready to send them back to the browser.
>
> CGI doesn't help. The problem is I'm sending across a variable of variables
> concatenated with |. And once these are passed, obviously, splitting
> doesn't work because there could have been a pipe in a variable that I put
> into the concatenated variable.
>
> My solution was to use a non-used character. I used hex character AB to
> join and split the variables.
Regardless, CGI.pm provides two subroutines (that may or may not be
documented at this time) called escape() and unescape() that are used to
encode and unencode variables for passage to CGI scripts.
For example:
: #!/usr/bin/perl -w
:
: use CGI;
:
: my @in = ('find -name core | find.out', 'ls *.py | py.out');
: print "In: $_\n" for @in;
:
: my @out = map { CGI::escape($_) } @in;
: print "Out: $_\n" for @out;
:
: my @final = map { CGI::unescape($_) } @out;
: print "Final: $_\n" for @final;
Returns:
: In: find -name core | find.out
: In: ls *.py | py.out
: Out: find%20-name%20core%20%7C%20find.out
: Out: ls%20%2A.py%20%7C%20py.out
: Final: find -name core | find.out
: Final: ls *.py | py.out
There. You can join('|', @out) and later split on the same and not lose
your pipe. If CGI.pm is too big/slow/some_other_objection, just copy
the code in the CGI.pm sub definitions into some other file.
--
-Tim Hammerquist <timmy@cpan.org>
Never put off until tomorrow that
which can be done the day after tomorrow.
-- Mark Twain
------------------------------
Date: 09 Mar 2001 17:36:34 -0800
From: Micah Cowan <micah@cowanbox.com>
Subject: Re: Macbeth and Perl threads
Message-Id: <yu8g0gm8kwt.fsf@mcowan-linux.transmeta.com>
"Peter van den Hamer" <vdhamer@msn.com> writes:
> Question: is it possible for one Perl (5.005-type) thread to kill
> another thread in that thread's sleep?
You can't do anything in your sleep, unless you arrange to be woken up
asynchronously, say by a SIGALRM or somesuch.
> In other words: can my main thread kill one of the other
> threads without waiting for a sleep(60) to complete?
> Alternative I have to break this down into an ugly loop
> around sleep(1) which checks my termination condition
> once a second instead of once a minute.
What I would do is avoid using sleep at all, and just use the loop to
find out when the escape key was pressed. Users like immediate
feedback. You may however have good reasons for not doing this.
Micah
------------------------------
Date: Fri, 9 Mar 2001 19:38:54 -0800
From: "Brian McCann" <bmccann@naisp.net>
Subject: Passing command line arguments to script
Message-Id: <taiu3smuf30f78@corp.supernews.com>
Hi,
This build script prompts the user for a tag such as PCS-1-0-0-Build45, when
the user enters the tag, that tag is pulled from source control then the
script
builds that code.
My question is, is there away to pass the tag PCS-1-0-0-Build45 on the
command line so I don't have to prompt the user for it, also is there away
to have a switch on the
command line so if I don't want to build to a tag the script would ignore
the first two system functions and just
execute the third in the script below.
what I'm looking for is something that looks like this
C:\javatagbuild.plx -t PCS-1-0-0-Build45 this would build a tagged build
and
c:\javatagbuild.plx without any switch or argument would only execute this
system ("cd d:\\AppsTagBuild\\$tag\\source \&\& cvs -d
:pserver:build\@scrumhalf:/cvs/cvsroot checkout -r $tag Applications" );
and the code that follows.
tia
Brian
#!/usr/local/bin/perl
#File: javatagbuild.plx
#Author: Brian McCann
#Project: Pactolus Release Scripts.
#DESC: Builds the nightly java code.
#(c) 2000 Pactolus Communication Software Inc. All rights reserved.
use warnings;
use strict;
use strict;
use File::Copy;
use File::DosGlob 'glob'; # overrides built-in version of glob
print "Please enter the TAG you want to build: ";
my $tag = <STDIN>;
chomp ( $tag );
system( "cd d:\\AppsTagBuild \&\& mkdir $tag\\source" );
system ("cd d:\\AppsTagBuild\\$tag\\source \&\& cvs -d
:pserver:build\@scrumhalf:/cvs/cvsroot checkout -r $tag Applications" );
system ('cd d:\ && cvs -d :pserver:build@scrumhalf:/cvs/cvsroot update
Applications/InternalProduct' );
....script goes on ...
------------------------------
Date: Fri, 09 Mar 2001 23:57:21 GMT
From: "What A Man !" <whataman@home.com>
Subject: Perl download problem with default link
Message-Id: <3AA96E59.D1182F61@home.com>
Why can WinZip grab this file...
http://members.tripod.com/~Mystiqal/Fonts.zip ...
but my browser or LWP can't?
The above URL is a Tripod page, and Tripod is sending me to a default
page when I try to download it with a perl script or from the browser.
I've tried using LWP's various downloading schemes, and all of them
still go to the webhost's default page, instead of to the correct .zip
file.
I posted another script here recently that used cookies that works to
bypass Fortune City's default page, but it won't work for Tripod...
probably because you have to go to the default page first, and then
click on the link. Can someone please tell me a perl solution on how to
bypass Tripod's default page, so that I can download a .zip file? ... OR
how to make perl go the default page and automatically click on the
link? Would a query string do it?
I wouldn't even worry with circumventing this server problem normally,
but
Tripod is a large host with millions of files.
>
Thanks,
--Dennis
>
------------------------------
Date: 09 Mar 2001 17:32:14 -0800
From: Micah Cowan <micah@cowanbox.com>
Subject: Re: Perl download problem with default link
Message-Id: <yu8itli8l41.fsf@mcowan-linux.transmeta.com>
"What A Man !" <whataman@home.com> writes:
> Why can WinZip grab this file...
> http://members.tripod.com/~Mystiqal/Fonts.zip ...
> but my browser or LWP can't?
>
> The above URL is a Tripod page, and Tripod is sending me to a default
> page when I try to download it with a perl script or from the browser.
> I've tried using LWP's various downloading schemes, and all of them
> still go to the webhost's default page, instead of to the correct .zip
> file.
>
> I posted another script here recently that used cookies that works to
> bypass Fortune City's default page, but it won't work for Tripod...
> probably because you have to go to the default page first, and then
> click on the link. Can someone please tell me a perl solution on how to
> bypass Tripod's default page, so that I can download a .zip file? ... OR
> how to make perl go the default page and automatically click on the
> link? Would a query string do it?
>
> I wouldn't even worry with circumventing this server problem normally,
> but
> Tripod is a large host with millions of files.
> >
> Thanks,
> --Dennis
> >
It could be that the URL checks your "Browser" HTTP Header field.
This doesn't seem likely, though. Are you /sure/ that WinZip gets
what it's supposed to from that URL?
I thought it might be a virtual server, requiring the use of the
"Host" field, but a quick check disproved that.
Micah
------------------------------
Date: 9 Mar 2001 23:34:18 GMT
From: doom@kzsu.stanford.edu (Joe Brenner)
Subject: Problem with getline in Text::CVS_XS
Message-Id: <98bp9q$mcb$1@nntp.Stanford.EDU>
Here's some fairly simple code that I'm pretty sure *should*
work according to the perldoc for Text::CSV_XS:
use IO::File;
use Text::CSV_XS;
$file = "some.csv";
$fh = new IO::File;
$csv = Text::CSV_XS->new();
if ($fh->open("< $file")) {
$columns = $csv->getline($fh);
print @{$columns};
$fh->close;
}
But the array_reference "$columns" is always undefined.
The line "print @{$columns}" always generates this warning:
Use of uninitialized value at
testes_IO_File_plus_CSV_XS line 17, <GEN0>
chunk 1.
Some other testing makes it clear I'm using IO::File right,
(I can do things like "print <fh>" to echo the input file to
the screen.)
I thought there was some possiblity it might be confused by
DOS line endings, so I tried manually converting the csv
file to unix text format first. That didn't have any effect,
(so I haven't looked too far into messing with the definition
of $/, but that doesn't seem to do anything either) .
Verisons:
perl 5.005_03 built for i686-linux
CSV_XS 0.22
IO::File 1.06021
------------------------------
Date: 10 Mar 2001 01:37:12 GMT
From: doom@kzsu.stanford.edu (Joe Brenner)
Subject: Re: Problem with getline in Text::CVS_XS
Message-Id: <98c0g8$p16$1@nntp.Stanford.EDU>
Okay, well I've figured out my problem with Text:CSV_XS.
The problem is that it just can't parse the data that I
was trying to feed into it. I was given some massive files
with lines of data like this (I have no idea what created these
files, they aren't necessarily just Excel output or something):
"2000-01-31", 286276, 119124, -17.98, 17.98, 0, "0", "none", "return", return, "-", "return", "return", "none", "Duluth", "MN", "USA", 55806, "0", "-", "-", "-"
"2000-01-31", 198180, 90813, -1.93, 1.93, 0, "0", "none", "return", return, "-", "return", "return", "none", "cape town", "cape province", "sa ", 7441, "0", "-", "-", "-"
And the trouble with this data? There are spaces after the
commas. CSV_XS *literally* wants comma separated values,
it can't handle commas plus whitespace.
And a s/, /,/g can't be used to fix the problem, either,
because there are definitely cases where ", " appears
inside the values. If I need to figure out whether a comma-space
is inside of a double quoted string before I fix it,
I might as well just write my own CSV parsing code.
Ugh.
------------------------------
Date: Fri, 9 Mar 2001 23:52:01 -0000
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: Reading and Writing to Files
Message-Id: <98bq7a$fd3$1@news6.svr.pol.co.uk>
Hello,
I was hoping someone could spend some time and explain why I am unable to
initially read from a given file and then write to it at the same time?
using the
+> operator?
open(FILE , ">+name.txt"); does not work!
secondly I am looking for the best way of transfering a set of variables
$x1
$y1
$x2
$y2
$x3
$y3
$x4
$y4
I need to feed these variable as a pair into $xn and $yn. For example I
would start off
with $xn =$x1 and $yn=$y1, and cycle through until I reach $x4 $y4
$Pxmin = $Pxmin < $xn? $Pxmin : $xn;
$Pymin = $Pymin < $yn ? $Pymin : $yn;
$Pxmax = $Pxmax > $xn ? $Pxmax : $xn;
$Pymax = $Pymax > $yn ? $Pymax : $yn;
How would I do that?
Thanking You
Kev
------------------------------
Date: Sat, 10 Mar 2001 01:40:49 -0000
From: "Brian J" <sorryno@email.at.all>
Subject: Re: Reading and Writing to Files
Message-Id: <3aa9862e$1_2@news2.uncensored-news.com>
"Milliwave" <milliwave@rfengineering.freeserve.co.uk> wrote in message
news:98bq7a$fd3$1@news6.svr.pol.co.uk...
> Hello,
>
> I was hoping someone could spend some time and explain why I am unable
to
> initially read from a given file and then write to it at the same
time?
> using the
> +> operator?
>
> open(FILE , ">+name.txt"); does not work!
<snip>
I'm only a relative newby, but I can tell you that +> erases the
contents of a file as soon as it's opened. I suggest for reading and
writing at the same time that you use +>>.
i.e.
open(FILE , "+>> $file");
--
Brian
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
------------------------------
Date: Sat, 10 Mar 2001 01:25:49 -0000
From: "Brian J" <sorryno@email.at.all>
Subject: scalar(localtime) in reverse?
Message-Id: <3aa982ab$1_1@news2.uncensored-news.com>
Is there anyway, for example, that 'Tue Jan 2 16:32:11 2001' can be
turned back into the number of seconds since the Unix epoch. I'm sure
it can be done with some complex mathematics, but is there a function
built in that will let me do this?
--
Brian
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
------------------------------
Date: Sat, 10 Mar 2001 01:56:58 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: scalar(localtime) in reverse?
Message-Id: <i42jatseh2vta90kttscnr2js40arjpa0c@4ax.com>
Brian J wrote:
>Is there anyway, for example, that 'Tue Jan 2 16:32:11 2001' can be
>turned back into the number of seconds since the Unix epoch. I'm sure
>it can be done with some complex mathematics, but is there a function
>built in that will let me do this?
No... I wouldn't count on it. Some date calculation modules just migth
do that. Check out Date::Calc (no experience here).
But this sting is easy to parse, i.e. convert into y/m/d/h/m/s as needed
for Time::Local, which is a standard module, to work properly. In fact,
the month will be the hardest part, and you can do that with a hash.
$_ = 'Tue Jan 2 16:32:11 2001' ;
use Time::Local;
@month = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
%month = map { $month[$_] => $_ } 0 .. $#month;
if(/^\w+ (\w+) (\d+) (\d+):(\d+):(\d+) (\d+)$/) {
my $time = timelocal($5, $4, $3, $2, $month{$1}, $6);
print "Time = $time -> ".localtime($time)."\n";
}
-->
Time = 978449531 -> Tue Jan 2 16:32:11 2001
--
Bart.
------------------------------
Date: Fri, 09 Mar 2001 18:03:06 -0500
From: Hermel Michaud <hermel_michaud@hotmail.com>
Subject: Re: using Perl for B2B?
Message-Id: <3AA9612A.D2CB374@hotmail.com>
Thanks Jon for giving your 2cents.
Here's more details to what i mean.
I am a programmer(im not a newbie, but i am a Junior Programmer(1 year
exp.)
What i want to do is the connect ONE big company with all of its vendors
for online transactions. I've been learning Java(servlets, JSP,EJB) for a
few weeks now, but someone told me Perl would be better for me since our
developement team is 2 or 3 persons max.
Jon Ericson wrote:
> Hermel Michaud <hermel_michaud@hotmail.com> writes:
>
> > Hello, I don't know Perl too much...Im currently learning Java Server
> > Programming for building b2b applications.
> > I want to specialize in building b2b for small and medium companies.
> > Someone told me Java technologie is too complicated for my needs and
> > recommended Perl.
> > I would appreciate it if someone can tell me if this is true...
> > Is Perl ideal for building b2b web sites?
>
> It depends on your situation:
>
> 1) If you aren't a programmer, but want to be, you should consider
> learning a general, beginner's programming language. Whether or not
> Perl counts is open to debate. I taught myself BASIC and learned
> Pascal at school. Throwing the web server into the mix is a mistake
> in my opinion.
>
> 2) If you aren't a programmer, and either don't want to be or want to
> get started right away, hire an experienced programmer. Ask her
> opinion, which is much more important to you than the opinion of some
> random person on a newsgroup.
>
> 3) If you are a programmer, what makes b2b differant from other sorts
> of web sites? Perl is very widely used for generating dynamic content.
>
> Jon
------------------------------
Date: 9 Mar 2001 23:08:15 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Weekend woes?!
Message-Id: <slrn9aioiv.7o8.abigail@tsathoggua.rlyeh.net>
Jon Ericson (Jonathan.L.Ericson@jpl.nasa.gov) wrote on MMDCCXLVII
September MCMXCIII in <URL:news:863dcm8vad.fsf@jon_ericson.jpl.nasa.gov>:
^^ "James Boulter" <jbou@bunker79.fsnet.co.uk> writes:
^^
^^ > I wandered if it was actually possible to tell if a date in the past was a
^^ > weekend day using something like perl's localtime function.
^^
^^ I believe that there are several modules at cpan.org that would be of
^^ use. You can also get the day of the week with something like:
^^
^^ $ perl -MTime::Local -e 'print scalar localtime(timelocal(0,0,0,30,10,1973))'
^^ Fri Nov 30 00:00:00 1973
^^
^^ [I was born on a Friday?!? I thought for sure it was a Wednesday.
^^ Wow, I just went from "full of woe" to "works hard for a living".
^^ Hmm... cal(1) says Friday as well.]
$ cal 11 1973
November 1973
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
$
Your cal must be broken.
Abigail
--
perl -wlne '}for($.){print' file # Count the number of lines.
------------------------------
Date: 09 Mar 2001 23:52:06 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Weekend woes?!
Message-Id: <86u2527b6h.fsf@jon_ericson.jpl.nasa.gov>
abigail@foad.org (Abigail) writes:
> ^^ [I was born on a Friday?!? I thought for sure it was a Wednesday.
> ^^ Wow, I just went from "full of woe" to "works hard for a living".
> ^^ Hmm... cal(1) says Friday as well.]
>
>
> $ cal 11 1973
> November 1973
> Su Mo Tu We Th Fr Sa
> 1 2 3
> 4 5 6 7 8 9 10
> 11 12 13 14 15 16 17
> 18 19 20 21 22 23 24
> 25 26 27 28 29 30
> $
>
>
> Your cal must be broken.
Actually my cal agrees with yours. It's my memory that's broken.
Jon
------------------------------
Date: Sat, 10 Mar 2001 12:35:56 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Weekend woes?!
Message-Id: <slrn9aj17s.uoe.mgjv@martien.heliotrope.home>
On Fri, 9 Mar 2001 17:04:11 -0500,
Tad McClellan <tadmc@augustmail.com> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>>On Fri, 9 Mar 2001 20:56:48 -0000,
>> James Boulter <jbou@bunker79.fsnet.co.uk> wrote:
>
>>> PLEASE FEEL UNDER NO OBLIGATION TO REPLY TO THIS E-MAIL EVEN IF YOU HAVE AN
>>> ANSWER.
>
>
>>MANY PEOPLE WITH
>>OBSESSIVE COMPULSIVE DISORDER POST HERE.
>
>
> Hi!
I didn't _specifically_ mean you, but I'm glad you spoke up! :)
Martien
--
Martien Verbruggen |
Interactive Media Division | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
Date: Sat, 10 Mar 2001 01:44:37 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Weekend woes?!
Message-Id: <po1jat4f2khlrpuvne2rsvppccr0r2nkq9@4ax.com>
Jon Ericson wrote:
>abigail@foad.org (Abigail) writes:
>
>> ^^ [I was born on a Friday?!? I thought for sure it was a Wednesday.
>> Your cal must be broken.
>
>Actually my cal agrees with yours. It's my memory that's broken.
You remember the day you were born? Wow. My first memories go back to
kindergarten, but not even that many.
--
Bart.
------------------------------
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 V10 Issue 458
**************************************