[8375] in Perl-Users-Digest
Perl-Users Digest, Issue: 1992 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 28 10:07:39 1998
Date: Sat, 28 Feb 98 07:00:31 -0800
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, 28 Feb 1998 Volume: 8 Number: 1992
Today's topics:
Books? <mfrana@spm.it>
Re: Books? <tchrist@mox.perl.com>
Re: CGI in Perl -- newbie <grg@philol.msu.ru>
Compare variable in loop - skip duplicate record? (Michael J. Collins)
Re: Compare variable in loop - skip duplicate record? (Craig Berry)
Re: Easy way to "clean" an array (continued) <grg@philol.msu.ru>
Re: Easy way to "clean" an array <grg@philol.msu.ru>
How do I create clickable database fields please ? <glenn@white.demon.co.uk>
Re: How do I search a file for a SPECIFIC string? <niting@raleigh.ibm.com>
Re: How do you put a string into a array? <westxga@ptsc.slg.eds.com>
Re: How do you put a string into a array? (Craig Berry)
Re: How do you put a string into a array? <palincss@nicom.com>
Re: How do you put a string into a array? <meconlen@intnet.net>
How to read a directory listing into an array? <fake@here.com>
Re: How to read a directory listing into an array? <rayreza@worldnet.att.net>
Re: How to read a directory listing into an array? (Jeffrey Drumm)
htpasswd in a script <vxcvxcv@jgj>
Re: Is perl -e broken? <grg@philol.msu.ru>
Re: mSQL troubles (Jonathan Feinberg)
Re: Passing an argument to a perl script. <rayreza@worldnet.att.net>
Perl & MS SQL Server <sebfrey@advancedh2o.com>
Problem with "goto" in Perl <angyny@interport.net>
using tie and database modules <yinso@u.washington.edu>
Year 2000 <MAXWELL-AD@ulst.ac.uk>
Re: Year 2000 <angyny@interport.net>
Re: Year 2000 (Jeffrey Drumm)
Re: Year 2000 <agr30@uni-koeln.de>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 28 Feb 1998 12:18:47 +0100
From: Matteo Frana <mfrana@spm.it>
Subject: Books?
Message-Id: <34F7F297.D82@spm.it>
What are the best books about Perl?
------------------------------
Date: 28 Feb 1998 14:14:36 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Books?
Message-Id: <6d964c$omt$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Matteo Frana <mfrana@spm.it> writes:
:What are the best books about Perl?
BEGINNING:
Learning Perl [unix]
Learning Perl on Win32 Systems [monoposoft]
Cross-platform Perl
Perl: The Programmer's Companion [NB: for compsci majors]
INTERMEDIATE:
Programming Perl
Perl5 Interactive
Effective Perl Programming
Advanced Perl Programming
--
Tom Christiansen tchrist@jhereg.perl.com
There is, however, a strange, musty smell in the air that reminds me of
something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
--Larry Wall in Configure from the perl distribution
------------------------------
Date: Sat, 28 Feb 1998 14:10:05 +0300
From: Grigoriy Strokin <grg@philol.msu.ru>
To: jtolley@es.com
Subject: Re: CGI in Perl -- newbie
Message-Id: <34F7F08D.A80E65DC@philol.msu.ru>
jtolley@es.com wrote:
>
> I'm a newbie to CGI programming (but know Perl fairly well). I'm trying to
> create a web page that allows people to post messages, as a sort of
> discussion forum. I understand this is fairly simple in Perl, but I don't
> know how to do it. Could someone please send me info/examples or direct me
> to informative web sites? Please e-mail to jtolley@es.com, rather than post
> replies, since I very rarely have the chance to look at news groups. Thanks
> a lot in advance.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
ftp://ftp.ora.com:21/published/oreilly/nutshell/learning_perl2/examples.tar.gz
------------------------------
Date: Sat, 28 Feb 1998 07:50:59 GMT
From: mike@w3z.com (Michael J. Collins)
Subject: Compare variable in loop - skip duplicate record?
Message-Id: <34f7bf1c.348149@news.tiac.net>
Where can I find the answer to this? I'm looping through a stack of
records wanting very much to skip records that have information
already seen (duplicate). Where (how) can I save a variable to
initiate conditional processing (skip) of the next record?
while (<DATA>) {
chomp;
$datalist = $_;
@listing = split(/\t/,$datalist);
$clone = "$listing[0]";
$clove = "$listing[1]";
$clive = "$listing[2]";
$jive = "$listing[3]";
}
It's an easy question, but help would sure be appreciated. If it's not
too much trouble, maybe you could also send a copy of your reply by
email if you would be so kind.
------------------------------
Date: 28 Feb 1998 08:11:15 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Compare variable in loop - skip duplicate record?
Message-Id: <6d8gr3$9f3$2@marina.cinenet.net>
Michael J. Collins (mike@w3z.com) wrote:
: Where can I find the answer to this? I'm looping through a stack of
: records wanting very much to skip records that have information
: already seen (duplicate). Where (how) can I save a variable to
: initiate conditional processing (skip) of the next record?
Not sure exactly what you're after, but your code below can be massively
simplified:
: while (<DATA>) {
: chomp;
: $datalist = $_;
: @listing = split(/\t/,$datalist);
: $clone = "$listing[0]";
: $clove = "$listing[1]";
: $clive = "$listing[2]";
: $jive = "$listing[3]";
: }
while (<DATA>) {
chomp;
($clone, $clove, $clive, $jive) = split /\t/;
# Do something with those four values...?
}
Now, what are you looking for a duplicate on? Where do you save
non-dups? A better problem description would help us help you.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Sat, 28 Feb 1998 14:32:18 +0300
From: Grigoriy Strokin <grg@philol.msu.ru>
To: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: Easy way to "clean" an array (continued)
Message-Id: <34F7F5C2.54B93FFA@philol.msu.ru>
David Fetter wrote:
>
> Schwitter Ruedi <Ruedi.Schwitter@schweiz.org> wrote:
> > Hi
>
> > I have a sorted array with duplicated entrys, like
>
> > 006621
> > 006621
> > 006622
> > 006623
> > 006623
> > 006623
> > 006624 usf.
>
> > Witch is the easiest way to check out the duplicated entrys ?
>
> > --
> > Regards Ruedi
>
> > ----------------------------------------------------------------
> > Ruedi.Schwitter@schweiz.org Tel: +41 56 205 59 40
> > Haselstrasse Fax: +41 56 205 21 21
> > CH-5400 Baden
> > ---------------------------------------------------------------
>
> --
> David Fetter 888 O'Farrell Street Apt E1205
> shackle@ren.glaci.com San Francisco, CA 94109-7089 USA
> http://www.best.com/~dfetter +1 415 567 2690 (voice)
> print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)
>
> Cuius testiculos habes, habeas cardia et cerebellum.
Or, if you just remove duplicate entries, not to check which theese
entries are,
@array = grep { $f=!defined($prev)||$prev ne $_; $prev=$_; $f } @array;
------------------------------
Date: Sat, 28 Feb 1998 14:25:00 +0300
From: Grigoriy Strokin <grg@philol.msu.ru>
To: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: Easy way to "clean" an array
Message-Id: <34F7F40C.225233B4@philol.msu.ru>
David Fetter wrote:
>
> Schwitter Ruedi <Ruedi.Schwitter@schweiz.org> wrote:
> > Hi
>
> > I have a sorted array with duplicated entrys, like
>
> > 006621
> > 006621
> > 006622
> > 006623
> > 006623
> > 006623
> > 006624 usf.
>
> > Witch is the easiest way to check out the duplicated entrys ?
map {
defined($prev) and $_ eq $prev and print "Duplicate found: $_\n";
$prev=$_;
} @array;
------------------------------
Date: Sat, 28 Feb 1998 09:16:00 +0000
From: Glenn White <glenn@white.demon.co.uk>
Subject: How do I create clickable database fields please ?
Message-Id: <tKvW3KAQX990Ew0A@white.demon.co.uk>
Hi there
I work for London University, and am writing a database interrogation
facility used in an astronomical research environment. I'd appreciate
it if someone could please point me in the right direction with this
problem
I have a unix perl script that read a ascii comma seperated variable
database, containing about 50,000 records each with 10 fields. My HTML
form takes in search words and reads the database looking for those
search words. When it finds a match, I print out all the fields for the
records which have a matching field.
My output is now becoming too big and I would instead like to send back
just two fields to the browser in such a way that I can identify the
records of interest, click on the displayed fields and then display
the rest of the records. Obviously I want to avoid re-reading the
whole database.
Does anyone know how to write PERL code which will identify records
which contain fields matching a keyword, and then return a short form
version of this which can then be clicked on in a browser, and then link
to the other associated fields ?
I see things like this done in the various cgi libraries to return
URL's, but that isn't actually what I want to do - I just want to get
at the fields in the records.
Many thanks for your help. I'd appreciate it if you would copy any
responses to g.j.white@qmw.ac.uk
Glenn White
--
Glenn White, Physics DEpartment, Queen Mary College, London University
--
Glenn White
------------------------------
Date: Fri, 27 Feb 1998 23:04:38 -0800
From: "Nitin Gupta" <niting@raleigh.ibm.com>
Subject: Re: How do I search a file for a SPECIFIC string?
Message-Id: <6d8coq$q7g$1@sjnews.sanjose.ibm.com>
I stand corrected.
-Nitin 'Little' :-) as per Uri@!
Uri Guttman wrote in message ...
>"Nitin Gupta" <niting@raleigh.ibm.com> writes:
>
>> Once you have the word you want, add a space before and after it (in the
>> variable) and then search, this will result in 'camel' always and never
hit
>> 'camels' even though the keyword in contained in this string.
>
>WRONGO my little friend. what if the word starts or end the line? the
>comment below from greg is correct.
>
>>
>> -Nitin
>>
>> Greg Bacon wrote in message <6d7c8t$e20$1@info.uah.edu>...
>> >
>> >Read the fine perlre manpage and search for `word boundary'.
> ^^^^
>misspelled :-)
>
>uri
>
>--
>Uri Guttman SYStems ARCHitecture and Software
Engineering
>uri@sysarch.com Have Perl, Will
Hack
>http://www.sysarch.com (781) 643-7504 x*2 FAX: (781)
643-2710
>Try the Best Search Engine on the Net -------->
http://www.northernlight.com
------------------------------
Date: Fri, 27 Feb 1998 09:34:34 +0000
From: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: How do you put a string into a array?
Message-Id: <34F688AA.5601@ptsc.slg.eds.com>
DKD CEO. wrote:
>
> Seong Y. Kim wrote:
> >
> > Let's say that I have a string "I you he she they me her him
> > his them their", and I want the array like this.
> >
> > $string = "I you he she they me her him his them their";
> >
> > @array;
> > $array [1]= "I";
> > $array[2]= "you";
> > $array[3]="he";
> > .....
> > $array[11]="their";
> >
> > how do you do this?
> >
> > thanks to ....... ;-)
>
> Just use:
>
> @array = $string
>
> There ya go!,
>
I don't think so...$string ends up in the first element of array. As
suggested by E. Bohlman, you'll need to use split...
------------------------------
Date: 28 Feb 1998 07:12:33 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How do you put a string into a array?
Message-Id: <6d8dd1$9f3$1@marina.cinenet.net>
John Stanley (stanley@skyking.OCE.ORST.EDU) wrote:
: In article <Ep1MnA.KHK@world.std.com>,
: Andrew M. Langmead <aml@world.std.com> wrote:
:
: >(Perl's arrays start counting at zero, not one. I know that perl is
: >supposed to have more than one way of doing most things, but zero
: >based arrays are so ingrained, fighting perl may not be worth it.)
:
: Perl's arrays start counting at whatever you want them to start counting
: at. Try perldoc perlvar.
But given how badly changing the default array base index can screw
things up, I'd say it's a very good idea not to do so.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 27 Feb 1998 18:05:20 -0800
From: Steve Palincsar <palincss@nicom.com>
To: dimitri102@hotmail.com
Subject: Re: How do you put a string into a array?
Message-Id: <34F770E0.2E34@nicom.com>
It's one thing to suggest that people RTFM, even scold them for not
doing so, while simultaneously providing them with the correct source
to answer their question.
It's quite another to deliberately give incorrect or misleading advice.
DKD CEO. wrote:
>
> Seong Y. Kim wrote:
> >
> > Let's say that I have a string "I you he she they me her him
> > his them their", and I want the array like this.
> >
> > $string = "I you he she they me her him his them their";
> >
> > @array;
> > $array [1]= "I";
> > $array[2]= "you";
[snip]
>
> Just use:
>
> @array = $string
>
> There ya go!,
>
> DK!
> +=
> http://dkd.home.ml.org/index.html -Web Design Like You've Never Seen.
------------------------------
Date: Sat, 28 Feb 1998 09:45:47 -0500
From: Michael Conlen <meconlen@intnet.net>
Subject: Re: How do you put a string into a array?
Message-Id: <Pine.LNX.3.95.980228094508.5825A-100000@baby.bigego.org>
On Fri, 27 Feb 1998, Steve Palincsar wrote:
> It's one thing to suggest that people RTFM, even scold them for not
> doing so, while simultaneously providing them with the correct source
> to answer their question.
>
> It's quite another to deliberately give incorrect or misleading advice.
Isn't it
@array = split / /, $string;
>
>
> DKD CEO. wrote:
> >
> > Seong Y. Kim wrote:
> > >
> > > Let's say that I have a string "I you he she they me her him
> > > his them their", and I want the array like this.
> > >
> > > $string = "I you he she they me her him his them their";
> > >
> > > @array;
> > > $array [1]= "I";
> > > $array[2]= "you";
>
> [snip]
>
> >
> > Just use:
> >
> > @array = $string
> >
> > There ya go!,
> >
> > DK!
> > +=
> > http://dkd.home.ml.org/index.html -Web Design Like You've Never Seen.
>
>
------------------------------
Date: 28 Feb 1998 09:53:43 GMT
From: "Alex" <fake@here.com>
Subject: How to read a directory listing into an array?
Message-Id: <01bd442e$b73aa460$050cd6cf@default>
How can I do this? I just need to get a dir listing into an array of
strings....seems simple but Im stumped... :( any help?
------------------------------
Date: Sat, 28 Feb 1998 14:58:24 -0500
From: Ray Reza <rayreza@worldnet.att.net>
Subject: Re: How to read a directory listing into an array?
Message-Id: <6d8uhs$jf5@bgtnsc02.worldnet.att.net>
Hi Alex
Here is the code
opendir(Dir,"C:\") || Cgidie("Can not opne directory");
while (defined($filename = readdir(Dir)))
{
# iterated through the files in dir C:\
}
closedir(Dir);
This code work on NT 4.0 i donot know if it will work on other
platforms.
I hope this helps you.
Alex wrote:
> How can I do this? I just need to get a dir listing into an array of
> strings....seems simple but Im stumped... :( any help?
------------------------------
Date: Sat, 28 Feb 1998 13:07:20 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: How to read a directory listing into an array?
Message-Id: <34f7ffea.41196727@news.mmc.org>
On 28 Feb 1998 09:53:43 GMT, "Alex" <fake@here.com> wrote:
>How can I do this? I just need to get a dir listing into an array of
>strings....seems simple but Im stumped... :( any help?
Please see the documentation included with every distribution of Perl for
the opendir and readdir functions. Examples abound.
You did check there first before posting, right? I'd be interested in
hearing what search criteria you used that failed to locate those specific
directory-related functions.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: 28 Feb 1998 09:36:41 GMT
From: "vcxcv" <vxcvxcv@jgj>
Subject: htpasswd in a script
Message-Id: <01bd442d$56493fa0$5200b8c2@saturn.sfera.net>
I'm making a perl script for letting my customers managing the htaccess
facility of apache. The problem is htpasswd. In fact, how can I pass to
htpasswd the password it request? There's no option like "-p password" not
to have promped any questions. Is it possible to let the
perl script answer automaticaly?
Thanks for anyone helping
Guido
info@server.sfera.net
------------------------------
Date: Sat, 28 Feb 1998 15:06:28 +0300
From: Grigoriy Strokin <grg@philol.msu.ru>
To: Reed Scarce <rscarce@hq.caci.com>
Subject: Re: Is perl -e broken?
Message-Id: <34F7FDC4.5F3A6D1C@philol.msu.ru>
You should not use command.com (exe), but rather
download bash or any other UNIX shell ported to DOS/Win.
command.com doesn't interpret signle quotes as quotes,
so
perl -e 'print "hello world\n";'
is supposed to have 3 arguments
ARG1 -e
ARG2 'print
ARG3 "hello world\n";'
which is surely not what you want...
Use bash from DJGPP or Cygnus GnuWin projects
>
> I'd like to run some one liners but I never get any std out or std
> error.
> From the prompt ('95 or NT)....
> C:\perl:>perl -e 'print "hello world\n";'
> C:\perl>
>
> that's all there is to it. -c tells me the syntax is fine, it does it
> in 5.? or 4.31. Many variations of quoting and content have resulted in
> errors or more of the same. More experienced perlsters have reported
> the same result.
>
> Is the -e switch broken?
>
> Thanks,
> Reed
------------------------------
Date: Sat, 28 Feb 1998 01:25:34 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: mSQL troubles
Message-Id: <MPG.f6177e783aa462e98974d@news.concentric.net>
[courtesy cc of this posting sent to cited author via email]
gconklin@iphysique.com said...
: Newbie here... please bare with me.
You're asking me to get naked? I hardly know you.
: $sth = $dbh->Query("INSERT INTO $table \(name,email\) VALUES
: \($name,$email\)");
Well, I use the DBD/DBI interface to mSQL, so I'm not 100% certain about this,
but mSQL expects string literals to be quoted. So you'd want
... VALUES ('$name', '$email') ...
Note that there's no reason to escape parentheses in a double-quoted string.
Also, before you submit that line, you'll want to
$name =~ s(')(\\')g; # escape single-quotes
Finally, when testing such code, divorce it from CGI, and run your script from
the command line or the debugger. Hope this helps.
--
#!/usr/bin/perl -w -- Just another Perl hacker,
(open 0),$_=<0>,s,.*- +,,,chop;for(split?@*?){($$_++or$}=$_,y,y \,\
y,<STDIN>,,$$=~s\^\"sub $_ {print'$}'};7"\ee),y,} \,},>STDOUT,,&$_}
# Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Sat, 28 Feb 1998 14:49:27 -0500
From: Ray Reza <rayreza@worldnet.att.net>
Subject: Re: Passing an argument to a perl script.
Message-Id: <6d8u13$jf5@bgtnsc02.worldnet.att.net>
Hi
If you want to pass an argument to the perl you can use system var
@_ to get that argument like this
sub t {
$str = @_;
#you can do wath ever with the value here.
}
Ray Reza
xxx123_thelion@superlink.net wrote:
> I'm trying to pass an argument (a string) to a perl script and
> manipulate this string within the script. How do I get this string into
> the script and for example print it out from inside the script. i.e.
> ./thisperlscript thisstring
>
> I'm executing this script from the command line.
>
> Remove "xxx123_" to send a response via email.
------------------------------
Date: Fri, 27 Feb 1998 16:09:46 -0800
From: "Sebastian" <sebfrey@advancedh2o.com>
Subject: Perl & MS SQL Server
Message-Id: <6d7kvf$a08$1@news0-alterdial.uu.net>
O' NT Perl Gurus -
I've just spent the better part of the day downloading various perl modules
and whatnot in the hopes of writing a few scripts to access data stored in a
Microsoft SQL Server 6.5 database. OK, I'll come right out and say it: I
can't even BEGIN to get it working. I've tried Win32::ODBC, MSSQL/DBLib,
and the ASP/ADO Examples that come with (I think) PerlScript. None of them
work, for a variety of reasons which I'll spare you.
What I would like to know is: is there a one-stop tutorial for just this
kind of thing? I've been going on a few snippets of HTML documentation here
and the occaisional text file there, but have yet to find any "grand
unifying tutorial" that could take me through this step-by-step. Is there
an URL that has this, or a book I can buy?
And does everyone have a preferred method for doing this? Is Win32::ODBC
the most popular?
Any advice anyone can provide will be _greatly_ appreciated!
Thanks in advance.
--Sebastian Frey
------------------------------
Date: Sat, 28 Feb 1998 07:22:44 +0800
From: Angy <angyny@interport.net>
Subject: Problem with "goto" in Perl
Message-Id: <34F74AC4.6486@interport.net>
I have a problem with goto in Perl. It looks alike perl can only "goto"
back to previous lines, but not afterwards lines (correct me if I'm
wrong). My perl code has 3 parts. In 1st part, I check some error
conditions, and if true, I need to exit 1st part. Actually I'd rather
use "goto" to exit 1st part and directly go into 2nd part. But since
perl seems don't understand goto a label defined afterwards, I have to
use die, but then I have to put 2nd & 3rd parts in the END {..}, which
is really inconvenient and not neat. Even DOS batch file can "goto" a
label defined afterwards. Can anyone help on this?
------------------------------
Date: Fri, 27 Feb 1998 23:21:54 -0800
From: Y Chen <yinso@u.washington.edu>
Subject: using tie and database modules
Message-Id: <Pine.OSF.3.96.980227231518.21760B-100000@saul9.u.washington.edu>
hello,
I have a problem using the DBM modules. My admin has installed module for
NDBM, ODBM, and SDBM. But since I've always used dbmopen to create the
databse file for me, I've never worried about creating the file myself.
Now I use the tie function to see if I can create the databse file just
like dbmopen, with something like this:
use NDBM_File;
tie (%db, 'NDBM_File', 'cars', O_RDWR|O_CREAT, 0644) or die $!;
$db{'car1'} = 'chevy camero';
$db{'car2'} = 'ford mustang';
untie %db;
and I get a message saying that "No such file" (referencing to the "cars"
database) exist.
Does anyone know how to solve my problem? Any input is appreciated.
ps. please Cc. my email address, thanks.
yin-so
------------------------------
Date: Sat, 28 Feb 1998 10:04:58 +0000
From: "A. Maxwell" <MAXWELL-AD@ulst.ac.uk>
Subject: Year 2000
Message-Id: <34F7E14A.63B2@ulst.ac.uk>
I am using then following piece of code to generate the time and date.
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$date_now = "$mday/$mon/$year";
$time_now = "$hour\:$min\:$sec";
The time function returns the number of non-leap seconds since January
1, 1970, what will happen in the year 2000 . As far as I know the year
has 1900 subtracted from it. Therefore I assume that the year will be
displayed as 00 for 2000, 01 for 2001 etc.
I look forward to your comments.
Thank-you
Alastair Maxwell
MSc student University of Ulster Northern Ireland
------------------------------
Date: Sat, 28 Feb 1998 07:28:23 +0800
From: Angy <angyny@interport.net>
Subject: Re: Year 2000
Message-Id: <34F74C17.4856@interport.net>
Well, it depends on how many bits used by perl for returning number of
seconds elapsed from Jan 1, 1970. It probably run out of bits sometime
in 20??. For the year, I just add 1900 back to it.
A. Maxwell wrote:
>
> I am using then following piece of code to generate the time and date.
>
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> $date_now = "$mday/$mon/$year";
> $time_now = "$hour\:$min\:$sec";
>
> The time function returns the number of non-leap seconds since January
> 1, 1970, what will happen in the year 2000 . As far as I know the year
> has 1900 subtracted from it. Therefore I assume that the year will be
> displayed as 00 for 2000, 01 for 2001 etc.
>
> I look forward to your comments.
>
> Thank-you
>
> Alastair Maxwell
>
> MSc student University of Ulster Northern Ireland
------------------------------
Date: Sat, 28 Feb 1998 13:07:21 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Year 2000
Message-Id: <34f900f6.41464652@news.mmc.org>
On Sat, 28 Feb 1998 10:04:58 +0000, "A. Maxwell" <MAXWELL-AD@ulst.ac.uk>
wrote:
>I am using then following piece of code to generate the time and date.
>
>($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
>$date_now = "$mday/$mon/$year";
>$time_now = "$hour\:$min\:$sec";
>
>The time function returns the number of non-leap seconds since January
>1, 1970, what will happen in the year 2000 . As far as I know the year
>has 1900 subtracted from it. Therefore I assume that the year will be
>displayed as 00 for 2000, 01 for 2001 etc.
Did you write that code yourself? If so, did you refer to the on-line Perl
documentation to get the array structure for localtime()? The answer's
right there in the narrative below the example . . . and you need to (re-)
read it carefully, since in your example $mon isn't what you think it is
either (unless, of course, January is month 0 in Ireland).
Perlfaq4 has a section on the Year 2000 issue . . . this is a FAR TOO
Frequently Asked Question (FTFAQ). Please check the documentation before
posting here. The noise is deafening.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: 28 Feb 1998 15:41:33 +0100
From: Martin Bialasinski <agr30@uni-koeln.de>
Subject: Re: Year 2000
Message-Id: <87wwefssf6.fsf@haitech.martin.home>
"A. Maxwell" <MAXWELL-AD@ulst.ac.uk> writes:
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> $date_now = "$mday/$mon/$year";
> $time_now = "$hour\:$min\:$sec";
>
> The time function returns the number of non-leap seconds since January
> 1, 1970, what will happen in the year 2000 . As far as I know the year
> has 1900 subtracted from it. Therefore I assume that the year will be
> displayed as 00 for 2000, 01 for 2001 etc.
OK, student. How much is 2000 - 1900 ? Should be arround 100 (if no new
intel bug^H^H^Herratum appears). Now what do you think is the output of
the following code?
$a = 2000 - 1900;
print $a;
Ciao,
Martin
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1992
**************************************