[8947] in Perl-Users-Digest
Perl-Users Digest, Issue: 2565 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 12 11:09:52 1998
Date: Tue, 12 May 98 08:01:00 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 12 May 1998 Volume: 8 Number: 2565
Today's topics:
Re: "URGENT!" requests <dformosa@st.nepean.uws.edu.au>
Re: A regex teaser that ALMOST works! (Greg Bacon)
Re: Anagram algorithm anyone. (John Porter)
Re: ASCII for arrow keys? <r.goeggel@atos-group.de>
c++ to html converter showell@nxt.com
Re: can't goto outside block (Andrew M. Langmead)
Re: chdir-command <noemi@dfki.uni-sb.de>
Re: chdir-command <noemi@dfki.uni-sb.de>
Re: chdir-command <jdf@pobox.com>
Re: Does Perl have a IDE?I don't like command line. (Greg Bacon)
Re: Does Perl have a IDE?I don't like command line. (Greg Bacon)
Re: Does Perl have a IDE?I don't like command line. <tchrist@mox.perl.com>
ERROR: odbc.pm, &AutoLoader::AUTOLOAD David@iqtexas.com
Friday-night Problem, Week 20 ... :) (Tina Marie Holmboe)
Re: function prototyping <tchrist@mox.perl.com>
Re: good and bad newsreaders (was: Re: QRe: == vs. eq) <abraham@dina.kvl.dk>
Re: Grieving our dying community (Nathan V. Patwardhan)
Re: Grieving our dying community (Tina Marie Holmboe)
guestbook <wade@mint.net>
Re: guestbook <lr@hpl.hp.com>
Re: Help with building GD for perl (WercRB)
Re: Installing PERL on NT <gmorgan@photographics.co.uk>
Re: NEWSFLASH::Nuclear-War (Greg Andrews)
Re: Perl as a compiled executable? (Andy Lester)
Program to give day of the week from given date <hari.patel@bt.com>
Re: Program to give day of the week from given date (Mike Stok)
RegExp: subst. commas with tabs (Bjvrn Nilsson)
Re: RegExp: subst. commas with tabs (Mike Stok)
Re: Total Object Uselesness (John Porter)
win32 - test for binary <lindermn@is4.nyu.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 May 1998 12:52:29 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: "URGENT!" requests
Message-Id: <894977549.948691@cabal>
In <35512a94.101576776@nntp.idsonline.com> root.noharvest.\@not_even\here.com (-) writes:
[...]
>It's called "center of the fucking universe" and this planet is full
>of them.
The term is Hubris.
--
I'm a perl programer; if you need perl programing, hire me.
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: 12 May 1998 13:17:36 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: A regex teaser that ALMOST works!
Message-Id: <6j9i5g$p90$4@info.uah.edu>
In article <6j82nk$rv0$3@comdyn.comdyn.com.au>,
mgjv@comdyn.com.au (Martien Verbruggen) writes:
: In article <6j712l$iae$3@info.uah.edu>,
: gbacon@cs.uah.edu (Greg Bacon) writes:
: > I reiterate: I wish Perl had an analogue to C's pointers to char.
:
: Hmm.. perl is of course, not c.
Ummm, yeah, but we do borrow a lot from C. From the very top of perlop:
Perl operators have the following associativity and
precedence, listed from highest precedence to lowest.
Note that all operators borrowed from C keep the same
precedence relationship with each other, even where C's
precedence is slightly screwy.
: But, perl provides an interface to C,
: called XS. it is probably possible to write a c function that can be
: interfaced through an XS sub, etc. of course, it would still be less
: efficient than real pointer operations, but that's a price one pays
: for abstraction.
Pointers aren't only efficient speedwise; they're also notationally
efficient. Consider the difference between code like
bump $pointer, $offset;
$c = dereference $pointer;
and code like
*dst++ = *src++;
: I even wonder if it would be more efficient than using substr.
I seriously doubt it. That's why I was looking for core support in the
first place!
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 12 May 1998 14:14:53 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Anagram algorithm anyone.
Message-Id: <MPG.fc2251578eb5d8f9896b1@news.min.net>
#
# quick anagrams
# by John Porter
#
#!/usr/local/bin/perl -w
my $word = join '', sort split //, lc shift;
my $len = length($word) || die "usage: $0 word\n";
open(F,"/usr/dict/words") || die "open /usr/dict/words: $!";
for (<F>) {
chomp;
print "$_\n"
if length == $len and $word eq join '', sort split //, lc $_;
}
close(F);
------------------------------
Date: Tue, 12 May 1998 13:40:53 +0200
From: "Ronald G\"oggel" <r.goeggel@atos-group.de>
Subject: Re: ASCII for arrow keys?
Message-Id: <6j9cik$4ra$1@news.pop-stuttgart.de>
Ala Qumsieh writes<35575074.F516660F@matrox.com>...
>Hi all,
>
>Does anyone know the ASCII (or hex or anything) representation of the
>arrow keys?
>I tried something like:
>
You may get it by the function getc (which is very slow, but yout can
get all key strokes).
But remeber:
The ESCAPE sequences may change if you go to an other machine.
HTH
Ronald
------------------------------
Date: Tue, 12 May 1998 14:18:52 GMT
From: showell@nxt.com
Subject: c++ to html converter
Message-Id: <6j9loc$1vl$1@nnrp1.dejanews.com>
I'm posting this here, because it seems like a problem that some one would
have solved in Perl:
I need a program that will convert C++ code into HTML format for documentation
purposes. There is only one feature I really need, but it is a tough one:
-- hyperlinks between function calls from source files in different source
files (link goes from use of function to definition of function)
I've found some nice tools that don't do the above. The following would be
nice, but not essential:
-- cross-directory hyperlinks
-- links to definitions of structures, etc.
-- color syntax
-- minimal code reformatting (i.e. don't change white space)
-- source code
Has anyone written a tool in Perl (or other language) to do this? Thanks.
Steve Howell
NXT
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 12 May 1998 14:15:09 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: can't goto outside block
Message-Id: <EsuKx9.4yp@world.std.com>
fpostma@xs4all.nl (Frans Postma) writes:
>The goto is giving me problems. When actually called it complains
>about "can't goto outside block". I do NOT jump outside a block, I
>merely skip some lines.
>Unless the sub{} calls itself a block as well, but then alarm and
>signal handling would be quite difficult. AFAIK this worked nicely up
>to 5.004_01 so who/why broke it in 04 ??
For things like this, the recommended method is to use eval {} and die:
eval {
alarm 10; local $SIG{'ALRM'}=sub{die "Alarm"};
if (connect(S,$paddr)) {
alarm 0;
select S; $|=1; select STDOUT;
return *S;
}
elsif ($::opt_log) { print STDERR "$0: connect(): $!\n" };
}
die $@ unless $@ =~ /^Alarm/; # propogate other exceptions.
sleep $time_between;
If you were avoiding eval because of its high overhead, be assured
that eval BLOCK doesn't recompile its argument each time, unlike
eval STRING.
--
Andrew Langmead
------------------------------
Date: Tue, 12 May 1998 14:43:55 +0200
From: Annette Preissner <noemi@dfki.uni-sb.de>
Subject: Re: chdir-command
Message-Id: <3558440B.2D1304E5@dfki.uni-sb.de>
Jonathan Feinberg wrote:
> wizard <root@dfki.de> writes:
>
> > chdir "$newsdir_alt" or die "Can't cd to $newsdir_alt: $!\n";
>
> First, you shouldn't be using those quotes around $newsdir_alt.
>
> Second, does that variable contain a *relative* path or an *absolute*
> path? If it's a relative path, then your assumptions about the
> working directory are probably wrong. Hope this helps.
>
> --
> Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
> http://pobox.com/~jdf/
Hi Jonathan,
I already tried leaving out the quotes, but that wasn't the problem.
I got the same error message with or without quotes or single quotes -
also, the variable contains an absolute path, not a relative one, and
my assumptions about the working directory are not wrong (as I demon-
strate in my reply to Eike). I am really kind of helpless now.
Noemi
------------------------------
Date: Tue, 12 May 1998 14:39:43 +0200
From: Annette Preissner <noemi@dfki.uni-sb.de>
Subject: Re: chdir-command
Message-Id: <3558430F.5EF51170@dfki.uni-sb.de>
Eike Grote wrote:
> Hi,
>
> wizard wrote:
> >
> > Hi, can anybody tell me what's wrong with the following
> > command in a perl program:
> >
> > chdir "$newsdir_alt" or die "Can't cd to $newsdir_alt: $!\n";
> > $newsdir_alt is set correctly (I have its value printed
> > just before the above command ... ), and if I type
> > cd <value> on the shell, everything works just fine,
> > but when I use the above command in my script, it
> > keeps telling me that the value of $newsdir_alt does
> > not exist ...
>
> You should check in which directory your script actually
> runs. Insert
>
> print `pwd`."\n";
>
> just before your failing chdir. If the mentioned script
> is to be run under UNIX check the permissions of the
> sub-directory ("Are you allowed to go into the desired
> directory?").
Hi Eike, I checked this out ... actually, this doesn't seem
to be the problem. print `pwd`."\n"; gives me the actual
working directory (from where I call the script ... I don't
change this directory in the code before calling chdir), and
I DO have the permissions to go to the desired directory,
and as I wrote in my first posting I CAN type cd <desired
directory> on the shell and it works ...
Noemi
------------------------------
Date: 12 May 1998 10:47:39 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Annette Preissner <noemi@dfki.uni-sb.de>
Subject: Re: chdir-command
Message-Id: <n2cntrs4.fsf@mailhost.panix.com>
Annette Preissner <noemi@dfki.uni-sb.de> writes:
> I already tried leaving out the quotes, but that wasn't the problem.
> I got the same error message with or without quotes or single quotes -
I know, but it's a bad habit to get into. Quotes are an operator, and
should be treated as such, for the sake of clarity.
> also, the variable contains an absolute path, not a relative one, and
> my assumptions about the working directory are not wrong (as I demon-
> strate in my reply to Eike). I am really kind of helpless now.
How are you invoking this script? What does the #! line look like?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 12 May 1998 13:33:59 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6j9j47$p90$5@info.uah.edu>
In article <rdm-1205980112530001@140.174.42.30>,
rdm@cfcl.com (Rich Morin) writes:
: In article <fl_aggie-1105982140000001@aggie.coaps.fsu.edu>,
: fl_aggie@thepentagon.com (I R A Aggie) wrote:
:
: > And I've come around to the point of view that perl is a miserable
: > [language] for people who've never programmed before.
:
: An opinion we have tried to disprove in "MacPerl: Power and Ease". We
: first explain fundamental programming concepts (three chapters), then
: introduce a subset of Perl (four chapters). Time will tell if this is
: enough background to allow the readers to wade into the "cookbook"
: and reference chapters that follow. (We *do*, in any case, point to
: the appropriate (generally ORA) books as ways to fill in the gaps...)
It would take nothing short of pedagogical genius to teach programming
in but three chapters of a book.
: >>>>> "Ken" == Ken Williams <ken@forum.swarthmore.edu> writes:
: Ken> The point is that beginners often lack some basic concepts that never
: Ken> would have occurred to the people that wrote the man pages.
:
: Unfortunately, books on programming languages often skip over basic
: concepts, as well. This saves space, to be sure, but makes it hard for
: beginners to climb on board. We decided to assume that our readers are
: intelligent and motivated, but not necessarily programmers; hence, our
: chapters on programming concepts. By the same token, we decided not to
: attempt a recapitulation of the ORA offerings (why be silly?).
If everyone included the basics in every book about programming
languages, we'd need much larger bookshelves. :-) Learning to program
is a lot like learning a natural language. We first teach babies to
speak (even if there sentences are very short and simple). Once they
have a fair grasp on expressing themselves, we teach them the
fundamentals of spelling, grammar, etc. Learning to program usually
involves a teaching language (since practical experience seems to be the
most helpful). Once students learn to program, they can be taught the
fundamentals of programming languages, and picking up new languages is
usually trivial.
If you want to fill the gap, I would think writing an introductory
programming text that used Perl for its examples would be ideal.
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 12 May 1998 13:47:58 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6j9jue$p90$6@info.uah.edu>
In article <6j7u8v$e29@mozo.cc.purdue.edu>,
gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
: gbacon@cs.uah.edu (Greg Bacon) writes:
: }Please give us three good reasons why we should stroke even one key to
: }help people who refuse to use man, perldoc, or grep? Perl requires at
: }least that much of a clue.
:
: Three good reasons to make the FAQs ridiculously easy to find:
:
: 1) To save yourself the inevitable frustration of having to read
: the same questions again and again from folks who don't "get"
: perldoc, man, or grep.
By ``get'', I'm assuming you mean software is unavailable. For one
thing, perldoc comes with every standard Perl distribution. Any
installation without perldoc is a broken installation. All ports have
the capability to generate HTML versions of the docs. It's the
responsibility of whoever installs perl to make sure that the docs are
available.
Other platforms have different help systems. For example, Ilya actively
maintains OS/2 book versions of the Perl docs. This is not a case of
bad design; it's a case of being unable to compel the equine to imbibe.
: 2) To save yourself the inevitable frustration of having to read or
: maintain code from people who never read FAQs.
See above.
: 3) Some people who would generally be considered "clueful" might
: even find it useful too.
The FAQ is useful to everyone. However, the clueful user knows to
incant `man perlfaq' or something equivalent.
: }Perl would cease to be the language we know and love if we watered it
: }down to meet the needs of the least common denominator. An army of Ken
: }Thompsons couldn't fully idiot-proof even the simplest program.
:
: So basically, you're counting on people to suddenly get smart. You
: optimists make me sick.
No, that's not my point at all. What I'm saying is that we must draw
the line *somewhere*. If we dumb Perl down too much, it would cease to
be useful.
: One lesson I've taken away from Donald Norman (_The Design of Everyday
: Things_) is that if you've got to keep telling people something over
: and over again ("Push to Open") you're doing something wrong.
Programming languages aren't and should never be everyday things.
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 12 May 1998 13:55:09 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6j9kbt$q6e$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
:Negative. Perl requires these abominations only on systems which do
:not have a clue what a good documentation is. Witness Perl-OS/2's
:distribution.
Ilya, just because you have no clue how to grep the mantree
doesn't mean others are also that stooopid.
--tom
--
"We are starting a movement in the state legislatures...to forbid the
installation of clinics that dispense contraceptives."
--Phyllis Schlafly, President, Eagle Forum
------------------------------
Date: Tue, 12 May 1998 13:51:47 GMT
From: David@iqtexas.com
Subject: ERROR: odbc.pm, &AutoLoader::AUTOLOAD
Message-Id: <6j9k5j$4r$1@nnrp1.dejanews.com>
RE: odbc, sql
I am attempting to print the contents of an Access DB.
The script fails @ Fetchrow. The DB appears to be setup correctly in ODBC
manager.
The output is below, then the script.
The DB was created by the ODBC manager. I then went into access to create
the table 'logon'.
Thanks for any help,
-David
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
OUTPUT__________________________________
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Untitled Document</TITLE>
</HEAD><BODY><HR><table>
Goto undefined subroutine &AutoLoader::AUTOLOAD at D:\Perl\lib/Win32/ODBC.pm
line 861.
SCRIPT___________________________________
# logon.mdb test
use CGI qw(:standard);
use Win32::ODBC;
print header;
print start_html(),hr();
$dsn="NetData";
if (!($db=new Win32::ODBC($dsn,"Internet","odbc"))){
print "Error connecting to $DSN\n";
print "Error: ",Win32::ODBC::Error(),"\n";
print hr(),end_html;
exit;
}
$db->Sql(" SELECT * FROM [logon] ");
print "<table>\n";
$i=0;
while ($db->Fetchrow()) {
$i++;
print "<OK here $i>\n";
%data=$db->Datahash();
print qq~
<tr>
<td>$data{logon}</td>
<td>$data{password}</td>
</tr>
~;
}
print "</table>";
$db->close();
print hr(),end_html;
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 12 May 1998 13:23:32 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Friday-night Problem, Week 20 ... :)
Message-Id: <6j9igk$7s6$1@news1.sol.no>
We all know what a Friday-night problem is - the missing ; that one
cannot for ones life find a) friday night, b) 5 minutes before deadline,
or c) the day before going on vacation.
This week saw me do the following:
#Code Snippet #2
my($Command) = 'lynx -dump -nolist file.html' ;
die("Unable to [$Command], $!\n") if ( ! open(PTR, "$Command|") ) ;
which is all fine, good, and By the Book - the book being perlfunc this
time. In order to test, one *does* of course do something like this:
#Code Snippet #2
my($Command) = 'lynx -dump -nolist file.html' ;
$Command = 'xxx' ;
die("Unable to [$Command], $!\n") if ( ! open(PTR, "$Command|") ) ;
However: snippet #2 showed an uncharacteristic ability to actually never
die. This was the source of much annoyment until a certain small light
started flashing. More experienced Perl'ers will, now, start guffaw'in.
Yep. Of course it never died. open(), and do correct me if I am wrong,
executes a shell, which in turn executes the command. The *shell* always
starts, and so the open() never fails.
Snippet #3 is as one would expect:
#Code Snippet #3
my($Command) = 'lynx -dump -nolist file.html' ;
my(@Result) = `$Command` ;
die("Unable to [$Command], $?\n") if ( defined $? ) ;
which of course works as planned...
--
Tina Marie Holmboe
Application Developer (Geeks'R'Us) [tina@tech.scandinaviaonline.se]
Scandinavia Online AB Development Dept. (+46) 08 587 81000 (switchboard)
(+46) 08 587 81189 (direct)
------------------------------
Date: 12 May 1998 13:56:07 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: function prototyping
Message-Id: <6j9kdn$q6e$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Martin Gregory <mgregory@asc.sps.mot.com> writes:
:> Until you can immediately tell what length(@a) returns
:> when @a = (1 .. 1), don't use prototypes.
:
:Why?
:
:In otherwords, I knew that length(@a) is 1, but I don't feel any more
:confident about function prototypes...
I mean @a = ( 1 .. 10 );
--tom
--
MSDOS was created to keep idiots away from Unix
------------------------------
Date: 12 May 1998 15:07:39 +0200
From: Per Abrahamsen <abraham@dina.kvl.dk>
Subject: Re: good and bad newsreaders (was: Re: QRe: == vs. eq)
Message-Id: <rjlns7bpt0.fsf@zuse.+dina.kvl.dk>
gbacon@cs.uah.edu (Greg Bacon) writes:
> Here's what Henry has to say on the matter (from Son-of-1036, Section
> 4.2.2, ``Undesirable Headers''):
Many people thought so when Henry wrote Son-of-1036, many years ago.
X-Newsreader had not yet proven it worth.
The current working paper (Grandson-of-1036) uses `User-Agent'
instead. Here is what it has to say:
The User-Agent header contains information about the user
agent (typically a newsreader) generating the article. This is
for statistical purposes and tracing of standards violations
to specific software needing correction. Although OPTIONAL,
user agents SHOULD include this header with the articles they
generate.
------------------------------
Date: 12 May 1998 13:46:52 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Grieving our dying community
Message-Id: <6j9jsc$gj5@fridge.shore.net>
Leon Stepanian (info@purco.qc.ca) wrote:
: Maybe we need a new group called comp.lang.perl.newbie where more
: mundane or direct questions could be addressed in a more layman style. I
: am sure, as I have in the past, that there are a large number of
Yeah, right. If one wants to get "all the answers", do they hang
around with other beginners or do they hang around with the "experts"?
The latter has proven itself true time and time again, so I do not
think that your theory holds true.
: You should not forget that we can't go to school to learn Perl. We are
You're kidding, right?
: What we are forgetting is that you are all on this newsgroup because you
: want be here. You want to help people. You like it when Perl is known.
Actually, I'd rather just discuss Perl or applications written in
Perl. Way back when, people argued *about* code but didn't ask for
handouts, because they did their homework. About two years ago, this
place became a helpdesk -- just about overnight.
: You need to show that you master the subject and you can stand as a
: pillar or lightpost for those who cannot see that far. So why then
This I agree with, BUT this shouldn't stop people from *learning* the
language, not just begging for scraps from someone else.
: understanding. That's what teaching is all about. Or maybe we have
: forgotten how to teach.
Then again, I don't know when people starting viewing Usenet as this
alternative to tutelage or formal education, but I believe that most
of the people who are around this group NEVER came here to teach for
*free*.
--
Nathan V. Patwardhan
------------------------------
Date: 12 May 1998 14:14:07 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: Grieving our dying community
Message-Id: <6j9lff$7s6$2@news1.sol.no>
In article <6j9jsc$gj5@fridge.shore.net>,
nvp@shore.net (Nathan V. Patwardhan) writes:
> handouts, because they did their homework. About two years ago, this
> place became a helpdesk -- just about overnight.
More or less the same time Perl became synonymous with WWW. Which has
later been told us ad nauseam.
Grumble. And all that.
--
Tina Marie Holmboe
Application Developer (Geeks'R'Us) [tina@tech.scandinaviaonline.se]
Scandinavia Online AB Development Dept. (+46) 08 587 81000 (switchboard)
(+46) 08 587 81189 (direct)
------------------------------
Date: Tue, 12 May 1998 09:23:05 -0400
From: wade <wade@mint.net>
Subject: guestbook
Message-Id: <35584D39.3294EAD@mint.net>
I am writing a guestbook script. It works fine but it is not printing
out the way i want it to. how do I print it out in reverse.
right now the info goes into a simple file - print
"$name|$url|$email|$comments\n";
and to print it out I just split at the | but it is printing first sign
to last sign, and I want it to print the last to sign to the first. how
do I do that?
thanks
wade
bachelde@cs.usm.maine.edu
------------------------------
Date: Tue, 12 May 1998 07:20:22 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: guestbook
Message-Id: <6j9lsg$5fg@hplntx.hpl.hp.com>
[posted and emailed]
wade wrote in message <35584D39.3294EAD@mint.net>...
>I am writing a guestbook script. It works fine but it is not printing
>out the way i want it to. how do I print it out in reverse.
>right now the info goes into a simple file - print
>"$name|$url|$email|$comments\n";
>and to print it out I just split at the | but it is printing first sign
>to last sign, and I want it to print the last to sign to the first. how
>do I do that?
>
>thanks
>wade
>bachelde@cs.usm.maine.edu
perldoc -f reverse
Read the entire file into an array:
my @array = <FILE>;
then deal with it in reverse:
print reverse @array;
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: 12 May 1998 14:38:34 GMT
From: wercrb@aol.com (WercRB)
Subject: Re: Help with building GD for perl
Message-Id: <1998051214383400.KAA06614@ladder01.news.aol.com>
come on, someone help me out here.
>I have been unable to install GD (1.18) for perl because
>the make file halts and says it can't find perlio.h.
>The file in question actually exists in several
>directories including the perl dir.
>
>The docs for GD say:
> (Please do not complain to me if your build fails with an
> error about not finding perlio.h. This file is part of more
> recent versions of Perl. You will need a recent version of
> Perl to compile and install this package).
>
>But I have the most recent official version (perl5.004_04) and
>it is still not working.
>
>Any suggestions for how I can solve this problem would be greatly
>appreciated.
>
>Thanks,
>Jon
>
>--------------------------------------------------
------------------------------
Date: Tue, 12 May 1998 15:54:56 +0100
From: "Glenn Morgan" <gmorgan@photographics.co.uk>
Subject: Re: Installing PERL on NT
Message-Id: <6j9nhg$h80$1@news.u-net.com>
Try downloading the Win32 port from www.activestate.com
It's a self extracting binary distribution, just download it and then
exectue the file to install it.
I've not had any problems with - dead easy.
Hauk Langlo wrote in message <3557F603.33C0D4B0@forumnett.no>...
>Hi there. After using PERL at work for some weeks I have finally got my
>own PC at home. I'm pretty new to the PC format and have not managed to
>successfully install/build perl on my PC. I got a file called
>perl5.00402-bindist04-bc. I have done the installation process but my
>perl programs will not work like they do at my job, they will not work
>at all really. Do anyone know exactly what kind of thins I will have to
>do in order to run PERL programs on my Win-NT PC? Any help would be
>apprecuated. Thanks.
>
>Hauk Langlo (JAPH)
>
>
------------------------------
Date: 12 May 1998 14:20:44 GMT
From: gerg@shell. (Greg Andrews)
Subject: Re: NEWSFLASH::Nuclear-War
Message-Id: <6j9lrs$huo$1@news.ncal.verio.com>
Looks like someone's alpha version of the NEWSFLASH module
was caught in a posting loop...
-Greg
------------------------------
Date: 12 May 1998 13:52:22 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Perl as a compiled executable?
Message-Id: <6j9k6m$agr$1@supernews.com>
: I want to hide a portion of my distributed script. I head that it is
: now possible to save your Perl scripts as a compiled executable. Does
: anyone know where I can find out about this?
The place to learn about everything Perl-related is www.perl.com.
It is there that you will find either a) what you want, or 2) that you
can't do what you want.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: Tue, 12 May 1998 14:40:33 +0100
From: Hari Patel <hari.patel@bt.com>
Subject: Program to give day of the week from given date
Message-Id: <35585150.D61A5345@bt.com>
Does anybody know how to output day of teh week for a given date in
perl
e.g. if you have date as 13/5/98 pass it to some function which
would output
Wednesday........
Please email me with any suggestions
hari.patel@bt.com
Many thanks
hari
------------------------------
Date: 12 May 1998 14:03:04 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Program to give day of the week from given date
Message-Id: <6j9kqo$4rt@news-central.tiac.net>
In article <35585150.D61A5345@bt.com>, Hari Patel <hari.patel@bt.com> wrote:
> Does anybody know how to output day of teh week for a given date in
>perl
> e.g. if you have date as 13/5/98 pass it to some function which
>would output
> Wednesday........
There are (at least) a couple of modules on CPAN, see http://www.perl.com
and follow the CPAN links. Picking Time::JulianDay you can say:
DB<1> use Time::JulianDay
DB<2> @name = qw/Sunday Monday Tuesday Wednesday Thursday Friday/
DB<3> print $name[day_of_week julian_day 1998, 5, 13]
Wednesday
DB<4> print $name[day_of_week julian_day 2098, 5, 13]
Tuesday
DB<5> print $name[day_of_week julian_day 98, 5, 13]
Tuesday
but you haven't said what '98' means as a year - one reasonable way to
disambiguate a 2 digit year is to use the current century, but that might
not be what you want.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Tue, 12 May 1998 14:06:38 GMT
From: bjorn.w.nilsson@edt.ericsson.se (Bjvrn Nilsson)
Subject: RegExp: subst. commas with tabs
Message-Id: <35585517.89027775@news.ericsson.se>
Hi all!
My problem is that I've gotten a 2 Mb file that's a DB dump. This file
contains "quoted" strings and empty fields separated with commas.
The problem is that the strings occationally contains commas too and
I'd like to keep them. That rules out using tr/,/\t/
How should I construct a RegExp that finds the number of commas ( and
only commas) in between two quotation marks and replaces them with the
same number of tabs?
It seems to ugly to do like this:
while (<INFILE>)
{
s/","/"\t"/g;
s/",,"/"\t\t"/g;
s",,,"/"\t\t\t"/g;
# Etc, till I find all possible combos. Horrid isn't it...
print OUTFILE $_ ."\n";
}
Regards
Bjvrn
------------------------------
Date: 12 May 1998 14:23:35 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: RegExp: subst. commas with tabs
Message-Id: <6j9m17$4rt@news-central.tiac.net>
In article <35585517.89027775@news.ericsson.se>,
Bjvrn Nilsson <bjorn.w.nilsson@edt.ericsson.se> wrote:
>Hi all!
>
>My problem is that I've gotten a 2 Mb file that's a DB dump. This file
>contains "quoted" strings and empty fields separated with commas.
>The problem is that the strings occationally contains commas too and
>I'd like to keep them. That rules out using tr/,/\t/
>How should I construct a RegExp that finds the number of commas ( and
>only commas) in between two quotation marks and replaces them with the
>same number of tabs?
Have you considered using the Text::CSV module from CPAN to split your
records into fields and then print join ("\t", @fields) or something
similar?
Alternatively you can look at section 4 of the FAQ which contains a
question (& answer to it) "How can I split a [character] delimited string
except when inside [character]? (Comma-separated files)"
On a recent perl installation
perldoc perlfaq4
should get you section 4, otherwise you might want to browse
http://www.perl.com and follow the FAQs link.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Tue, 12 May 1998 14:41:15 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Total Object Uselesness
Message-Id: <MPG.fc22b43bc5d27e69896b2@news.min.net>
On Sat, 09 May 1998 17:09:11 GMT,
in article <pudge-0905981307190001@192.168.0.3>,
pudge@pobox.com (Chris Nandor) wrote:
>...
> $x = 'foobar';
> $y = bless \substr($x, 3), "D'oh";
> sub D'oh'oh {${$_[0]} = $_[1]}
That is without a doubt the coolest thing I have ever seen.
At least, since I learned about blessed CODE refs and closures.
John Porter
------------------------------
Date: Tue, 12 May 1998 09:18:21 -0400
From: Liza Linderman <lindermn@is4.nyu.edu>
Subject: win32 - test for binary
Message-Id: <35584C1D.7BF8422B@is4.nyu.edu>
Hello - I'm a fairly competent PERL user on a Unix Platform, but have
the good fortune to have to do some perl scripting with W32. Is there a
way to test a file for being a bin mode file prior to working with it?
Ruben
------------------------------
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 2565
**************************************