[9628] in Perl-Users-Digest
Perl-Users Digest, Issue: 3222 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 22 09:07:28 1998
Date: Wed, 22 Jul 98 06:01:16 -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 Wed, 22 Jul 1998 Volume: 8 Number: 3222
Today's topics:
Re: Better way of saying this. (Andrew M. Langmead)
Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. p (Bart Lateur)
DBD/DBI/whatever accessing remote MS SQL-server <pinne@pegit.se>
Re: Expand variables without expanding "\t"'s - how? (Ilya Zakharevich)
Re: Filedate under win32 (Jeffrey R. Drumm)
first cookie not expiring the_smiths@usa.net
first cookie not expiring zucker@my-dejanews.com
Re: Formats question <barnett@houston.Geco-Prakla.slb.com>
Re: Getting format with write to place spaces at the en (Andrew M. Langmead)
Re: HELP - MS personal web server and cgi mrauschkolb@my-dejanews.com
How to access modem on NT ( terminal and ppp ). <xiong@bigfoot.com>
Re: Pattern Matching Snafus <etoxkar@eto.ericsson.se>
Re: Perl Beautifier Home Page (Bart Lateur)
Re: Perl Beautifier Home Page <rra@stanford.edu>
Re: permissions? <martin.riedlberger@lfstad.bayern.de>
Re: problems compiling perl5 on sun <Eric.Zylberstejn@wanadoo.com>
Reading in a txt file to an associative array - Beginne <l.d.fortnam@iti.salford.ac.uk>
Re: Reading in a txt file to an associative array - Beg <quednauf@nortel.co.uk>
removing a line from a textfile <thijs@esense.nl>
Re: removing a line from a textfile <quednauf@nortel.co.uk>
Reversing time martin_harriss@my-dejanews.com
Re: Reversing time <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: slick ideas that don't work mrauschkolb@my-dejanews.com
Socket <jake@net10.net>
SPLIT help please horseyride@hotmail.com
Re: system("grep edu list|wc -l>a") <qdtcall@esb.ericsson.se>
Re: Tcl is better than Perl mrauschkolb@my-dejanews.com
Re: Trouble with ActiveState - urgent <spbrooke@bbag.demon.co.uk>
verifying urls without download them <mauro@franchisetech.com>
Re: Web Components birgitt@my-dejanews.com
Re: What is Value of <HANDLE> ? (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 22 Jul 1998 11:47:18 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Better way of saying this.
Message-Id: <EwHvEy.AG3@world.std.com>
Jim Woodgate <jdw@alder.dev.tivoli.com> writes:
>I don't know if it's easier or more elegant, but you can do the
>foreach/unless in a one liner:
>grep { $teststring =~ /$_/i } @allowed or die "Sorry not found, stopped";
The foreach has one advantage in that you can stop the loop as soon
the first match is found, cutting the average number of iterations of
the loop in half.
And in an expensive process like a runtime contstructed regular
expression, you want to cut out as many iterations as possible. Which
is why the FAQ entry that I mentioned early in the thread uses eval to
create "compile time" regular expressions at "run time".
--
Andrew Langmead
------------------------------
Date: Wed, 22 Jul 1998 09:41:22 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. print)
Message-Id: <35baaf86.7356160@news.tornado.be>
OK, I'll bite.
>1. Who is main the PERSON you should think about while you are writing code?
The user of the program. I always assume it's a first-time user, so the
interface should be as logical as possible. The user should be able to
figure it out without any manual. Nobody reads manuals, anyway.
>2. Other than comments, what is the most important HUMAN aspect of code?
Correctness. Code should do what you expect it to do. Hey, what kind of
quiz is this anyway?
>3. What is the main PURPOSE of comments?
Explain the purpose of the code. You only need comments if the code
isn't self-commentary enough.
>Bonus: What is the OPPOSITE of spaghetti code?
Straight code. Let me explain: spaghetti code jumps from here to there
and anywhere. The opposite is no jumps at all, not even subroutine
calls. The code statements are simply executed in the same order as they
are in the source.
Bart.
------------------------------
Date: Wed, 22 Jul 1998 12:51:04 +0200
From: Pinne <pinne@pegit.se>
Subject: DBD/DBI/whatever accessing remote MS SQL-server
Message-Id: <35B5C418.3937@pegit.se>
Hi,
I'm looking for a way to access a remote MS SQL-server database on
an NT-server from within a Perl-script running on a Unix system.
I have been looking through the DBI/DBD and all that but not found any
specific information on that.
Has anyone done this, have any clues etc to share I'd be most gratefull.
/Best Regards
--
Bjvrn-Eke Segrell / Pegit AB
Email:pinne@pegit.se
Url:http://www.pegit.se
Phone:+46-(0)8-56030220, Fax:+46-(0)8-56034353
------------------------------
Date: 22 Jul 1998 11:10:30 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Expand variables without expanding "\t"'s - how?
Message-Id: <6p4hb7$rle$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Steve Mading
<madings@earth.execpc.com>],
who wrote in article <6p41b2$gaj@newsops.execpc.com>:
> Example: $var is set to "C:\tempdir\filename", but the
> "\t" and "\f" are literally in the string (not a tab and
> a formfeed) I want to print out the contents, like
> so: print "the file is called $var\n", but when I do,
> it substitutes the tab for \t and the formfeed for \f.
Here is your confusion:
$foo = "\t"; # Line 1
print "foo is $foo\n"; # Line 2
The conversion of `text' \t to TAB happens at line 1, not at line 2.
Thus you need to correct the line 1, (preferably by not using
backslashes in file names ;-). Try "c:/tempdir/filename", or, as a
last resort, 'C:\tempdir\filename'.
Hope this helps,
Ilya
> If I switch to singlequotes to protect the backslashes,
> then I can't interpolate the string with "$var" either.
>
> Yes, I am already aware of the ability to double-backslash
> the backslahses, but in this application that isn't very
> easy to do. The string needs to remain pure and
> unmolested for work in other parts of the code I didn't
> write.
>
> Reason for the problem: This is for a web site where
> the perl script needs to accept filenames in *any* form
> for any OS, and that includes Windows's backward slashes.
> --
> Steve Mading: madings@execpc.com http://www.execpc.com/~madings
>
------------------------------
Date: Wed, 22 Jul 1998 11:05:29 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Filedate under win32
Message-Id: <35b5c585.432932153@news.mmc.org>
[ posted to comp.lang.perl.misc; courtesy copy not mailed because of useless
from: address ]
On Tue, 21 Jul 1998 16:57:58 GMT, (Duane Smith) wrote:
(snip)
>Greetings,
>
>I am trying to get the date of a file using stat under perl for win32.
> I can get the filename, size, etc., but not the date. What is the
>answer?
>
>TIA,
>- --James
(snip)
You really didn't give us enough information to provide a useful answer. What
does your code look like?
I get the expected results with:
C:\> perl -e "print scalar localtime((stat $ARGV[0])[10])" filename
Element 10 in stat's returned list is ctime, which apparently corresponds to
Win32's creation time.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Wed, 22 Jul 1998 10:36:04 GMT
From: the_smiths@usa.net
Subject: first cookie not expiring
Message-Id: <6p4fal$39i$1@nnrp1.dejanews.com>
Hi,
I have a subroutine that expires all the cookies based on what is passed to
it.
Ex. &deleteCookies("star");
which should expire all the cookies that contain the string star. The code for
the subroutine is:
sub deleteCookies
{
my ($search) = @_;
my (@cookies,@temp);
my $old_expire_date = "Mon, 03-Jun-96 00:00:00 GMT";
my $refresh_url = "http://www.whatever.com/cgi-bin/displayMyCookies.cgi";
@cookies = split (/;/,$ENV{'HTTP_COOKIE'}); #get the cookies
for (@cookies)
{
@temp = split (/\|/,$_);
if ($temp[7] =~ /$search/i) { $temp[0] =~ s/\s+|=//g; #strip leading
spaces and the '=' character print "Set-Cookie: $temp[0]=;
expires=$old_expire_date\n"; } }
print "\n";
print qq!<HTML><HEAD><META HTTP-EQUIV="REFRESH"
CONTENT="0;URL=$refresh_url"></HEAD><BODY></BODY></HTML>!;
} #end deleteCookies
when the refresh is performed, all cookies except for the first one are
expired (that matches the string that is passed in). Before calling
&deleteCookies("star"), the main routine opens, writes & closes files...could
this be an problem with buffering? I've tried to set $| = 1 in the main
routine, but nothing.
Thanks in advance.
Rob.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 22 Jul 1998 10:51:31 GMT
From: zucker@my-dejanews.com
Subject: first cookie not expiring
Message-Id: <6p4g7j$490$1@nnrp1.dejanews.com>
Hi,
I have a subroutine that expires all the cookies based on what is passed to
it.
Ex. &deleteCookies("star");
which should expire all the cookies that contain the string star. The code for
the subroutine is:
sub deleteCookies
{
my ($search) = @_;
my (@cookies,@temp);
my $old_expire_date = "Mon, 03-Jun-96 00:00:00 GMT";
my $refresh_url = "http://www.whatever.com/cgi-bin/displayMyCookies.cgi";
@cookies = split (/;/,$ENV{'HTTP_COOKIE'}); #get the cookies
for (@cookies)
{
@temp = split (/\|/,$_);
if ($temp[7] =~ /$search/i) { $temp[0] =~ s/\s+|=//g; #strip leading
spaces and the '=' character print "Set-Cookie: $temp[0]=;
expires=$old_expire_date\n"; } }
print "\n";
print qq!<HTML><HEAD><META HTTP-EQUIV="REFRESH"
CONTENT="0;URL=$refresh_url"></HEAD><BODY></BODY></HTML>!;
} #end deleteCookies
when the refresh is performed, all cookies except for the first one are
expired (that matches the string that is passed in). Before calling
&deleteCookies("star"), the main routine opens, writes & closes files...could
this be an problem with buffering? I've tried to set $| = 1 in the main
routine, but nothing.
Thanks in advance.
Rob.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 22 Jul 1998 07:22:22 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: Jeffrey Fulmer <jfulmer@whiteoaknet.com>
Subject: Re: Formats question
Message-Id: <35B5D97E.EA213151@houston.Geco-Prakla.slb.com>
[courtesy cc to cited author]
Jeffrey Fulmer wrote:
>
> Hi,
> I'm really stumped. I'm trying to send formated mail...
>
> $sendmail = "/usr/bin/qmail-inject -f " . qq("jfulmer\@whiteoaknet.com")
> . " jfulmer";
> open( SENDMAIL, "| $sendmail");
>
> $~ = "HEADER";
> write SENDMAIL;
>
> } # end
>
> format HEADER =
> Billing Name Shipping Name
> .
What exactly is it that you expect to happen, given this format?
I expect you're getting mail that has:
Billing Name Shipping Name
repeated once per the number of lines you're wrinting.
You need to have a look at Learning Perl (2nd ed), or Programming Perl
(2nd ed). Both go into detail regarding formats. Basically, you need
to tell perl what you want printed.
format HEADER_TOP =
Billing Name Shipping Name
---------------------------------------------------------------------
.
format HEADER =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$billingName, $shippingName
.
HTH.
>
> Could somebody steer me in the right direction? I'd appreciate it.
> Thanks,
> Jeff
Dave
--
Dave Barnett
"Sometimes you just need the clear epiphany of an a$$-kicking."
-- Nathan Regener
------------------------------
Date: Wed, 22 Jul 1998 11:29:23 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Getting format with write to place spaces at the end of line?
Message-Id: <EwHuKz.274@world.std.com>
"Scott T. Prugh" <sprugh@telution.com> writes:
>My output is
>130 bar
>without the spaces.
>I need the spaces as a filler. How would I do this?
Would it be possible to use pack() or printf() instead of formats?
print pack 'A6 A1 A6 A1 A12 A1', $id, ' ', $name, ' ', $spaces, "\n";
printf "%-6.6s %-6.6s %-12.12s\n", $id, $name, $spaces;
--
Andrew Langmead
------------------------------
Date: Wed, 22 Jul 1998 12:13:10 GMT
From: mrauschkolb@my-dejanews.com
Subject: Re: HELP - MS personal web server and cgi
Message-Id: <6p4l0n$9n0$1@nnrp1.dejanews.com>
No it's not really a perl issue, but here's the answer anyway:
If you have the web server installed, start the "Internet Service Manager"
then choose Topics from the Help menu, and look at chaper 10 "Configuring
Registry entries"
Mark
In article <35B349A3.B3C@flash.net>,
dtbaker_@flash.net wrote:
> Dale Sutcliffe wrote:
> >
> > How do I configure personal web server to accept cgi scripts?
> -----------
> This isn't really a perl issue.... for cgi type questions, you might
> want to check out news:comp.infosystems.www.authoring.cgi
>
> but try the xitami server instead, it is small, fast, and works right
> out of the box. http://www.imatix.com/
> --
> Thanx, Dan
>
> # If you would like to reply-to directly, remove the _ from my username
> * Use of my email address regulated by US Code Title 47,
> Sec.227(a)(2)(B) *
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 22 Jul 1998 12:25:11 GMT
From: Meng Xiong <xiong@bigfoot.com>
Subject: How to access modem on NT ( terminal and ppp ).
Message-Id: <35B5DB54.E157E2B2@bigfoot.com>
Is there a module that I can use to establish a ppp connection and a
direct dial in connection on Windows NT? Thanks for the help.
--
7220 Mccallum Blvd. #1302 (972) 380-6028 (home)
Dallas, TX 75252 (972) 685-8268 (office)
------------------------------
Date: Wed, 22 Jul 1998 12:00:32 +0200
From: Kjell Arne Rekaa <etoxkar@eto.ericsson.se>
Subject: Re: Pattern Matching Snafus
Message-Id: <35B5B840.ADD30F59@eto.ericsson.se>
groans@mailexcite.com wrote:
>
> split things up until the last "</script>." I hope someone will have some
Simply add in the beginning:
$/ = "</script>";
or:
use English;
$INPUT_RECORD_SEARATOR = "</script>";
Also remember the "s" option in your regexps (m//s) to let . (dot)
match a "\n" (new line)
> advice for my on this. I have been looking everywhere for some answer to how
> to do this (yes I have three books on perl). Thanx in advance!
If it's really books about programming Perl,
they should all have documentation about this...
--
Kjell Arne Rekaa
Work:[+47] 66 84 17 88 Priv: 22 95 08 09 Mob: 920 30 233
Email: Kjell.Arne.Rekaa@Ericsson.no
Though I'll admit readability suffers slightly...
--Larry Wall in <2969@jato.Jpl.Nasa.Gov>
------------------------------
Date: Wed, 22 Jul 1998 09:41:18 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Perl Beautifier Home Page
Message-Id: <35b7a990.5830014@news.tornado.be>
John Porter wrote:
>Care to justify the use of variable width fonts for coding?
Why not? :-) Even if you might succeed to convince me into using fixed
pitch fonts for code, there will still be thousands of people who still
write code that way. So a "general solution" that only works if you use
fixed pitch fonts, is not a general solution. That was my argument.
There. And now for a more personal touch: if I read code in a fixed
pitch font, like Courier, I notice that it tires me after a while. After
only 10 minutes, I notice that I'm starting to stare at the letters. I
must really concentrate to simply see what is written there. Besides,
Courier is just a damn ugly. :-)
So, the reason to use a variable pitch font, is the same reason why
there are no books printed in a fixed pitch font either: variable pitch
is simply far easier to read. Code is just text, anyway. To me it is. I
want to look beyond the letters, into the actual text. A variable pitch
font surely helps.
The consequence is that I cannot rely on secondary indents, i.e. indents
following text other than whitespace. Primary indents work just fine,
either using spaces (they're all equally wide) or tabs.
And in another post, Zenin wrote:
> I don't think I've even seen an code editor that supported
> variable width fonts at all, for good reason.
Hmmm... I've always assumed that was just pure laziness of the
programmer. A variable pitch editor is more difficult to write.
Bart.
------------------------------
Date: 22 Jul 1998 02:11:06 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl Beautifier Home Page
Message-Id: <m3yatm9ro5.fsf@windlord.Stanford.EDU>
Bart Lateur <bart.mediamind@tornado.be> writes:
> So, the reason to use a variable pitch font, is the same reason why
> there are no books printed in a fixed pitch font either: variable pitch
> is simply far easier to read. Code is just text, anyway. To me it is. I
> want to look beyond the letters, into the actual text. A variable pitch
> font surely helps.
But computer screens also aren't books. Fixed-width fonts, provided that
they're well-designed for screen viewing (Courier most definitely is *not*
-- it's far too spindly), are at least in my opinion *dramatically* more
readable in the very limited-resolution and emitting rather than absorbing
world of CRTs.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Wed, 22 Jul 1998 14:50:02 +0200
From: Martin Riedlberger <martin.riedlberger@lfstad.bayern.de>
Subject: Re: permissions?
Message-Id: <35B5DFFA.24BECBC8@lfstad.bayern.de>
The cgi path must be known by the server, which is the provider's job, and the
script file must be set executable, for example by the ftp-command 'chmod 774
filename'.
Marjorie MacDonald wrote:
> I'm trying to get a script to run. I didn't write it, I'm using it as a
> learning tool, once I get it to run I'll make changes and see what happens.
> (I learn best that way.)
>
> We have a provider that hosts our web site. They have created a CGI
> directory for my files, on a UNIX server which supposedly runs PERL. I
> haven't been able to get much help or info from them, which doesn't help
> matters... ('What can I run?' 'not sure...' 'Do you support any MS
> extensions? Can I run VBScript? Can I make a call to a VB program?' I get
> no answers...)
>
> So I find a PERL program that SHOULD work.. upload it, try to call it and
> get
> 403/Permission denied. Your client does not have access to get...
>
> I tried calling it directly, making a link to it on a web page, etc. Same
> thing. Is this something on THEIR end? Do they need to change permissions
> on the directory? Would I get this message if they were running an older
> version of PERL and my script was for a newer one?
>
> Since I don't have access to the actual web server, I can't check
> anything... don't have any error logs, etc. If anybody can give me a clue
> as to what might be causing this error, I can either work on fixing it or
> call them and tell them what they need to check.
>
> Thanks!
> Marjorie MacDonald
> Dover, DE USA
------------------------------
Date: Wed, 22 Jul 1998 12:09:52 +0200
From: Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com>
To: Henryrb <henryrb@aol.com>
Subject: Re: problems compiling perl5 on sun
Message-Id: <35B5BA70.2C12751F@wanadoo.com>
Hello,
Henryrb wrote:
>
> Hi, I have a sunos 5.5.1 sun4u sparc SUNW,Ultra-5_10 machine. I've tried
> compiling it and used the hints in the install file, but I can't even get it to
> make anymore - it says
> [...]
This is really strange I never had these kind of problems. Make sure :
* you are trying to compile Perl 5.004_4 (unless you want to try the new beta
version)
* you are up to date with Sun's recommended patches.
I succeeded compiling Perl a handful of times on Solaris 2.5.1 with Sun's cc
-XO4, on Solaris 2.6 with Sun's cc -XO4, and on Solaris 2.6 with gcc 2.8.1.
Eric.pl
------------------------------
Date: Wed, 22 Jul 1998 10:45:13 +0100
From: Lee Fortnam <l.d.fortnam@iti.salford.ac.uk>
Subject: Reading in a txt file to an associative array - Beginner ? Sorry
Message-Id: <35B5B4A9.8759975D@iti.salford.ac.uk>
I need to be able to read a txt file of about 300 lines into an array,
each line has 5 fields. Before there were only around 20 products and so
it wasn't a prob as below as they were kept in the scipt itself.
%inventory = (
'item01','00001#Item 1 description#12.00#21.50',
'item02','00021#Item 2 description#16.00#31.32',
'item03','04001#Item 3 description#22.00#41.23',
'item04','00201#Item 4 description#27.00#51.76',
'item05','00211#Item 5 description#33.00#61.48',
'item06','10001#Item 6 description#12.00#21.50',
'item07','10021#Item 7 description#16.00#31.32',
'item08','14001#Item 8 description#22.00#41.23',
'item09','10201#Item 9 description#27.00#51.76',
'item10','10211#Item 10 description#33.00#61.48',
'item11','P&P#Postage and Packing#5.00#8.00',
'item12','Ins#Optional Delivery Insurance#3.00#5.00'
);
but I would like to be able to create my txt file from a dbase or excel
prog and update the file when I need to without editing the main file.
Any ideas would be appreciated.
Lee Fortnam
lee@sozo.co.uk
------------------------------
Date: Wed, 22 Jul 1998 11:19:21 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Reading in a txt file to an associative array - Beginner ? Sorry
Message-Id: <35B5BCA9.BF4766BE@nortel.co.uk>
Lee Fortnam wrote:
>
> I need to be able to read a txt file of about 300 lines into an array,
> each line has 5 fields. Before there were only around 20 products and so
> it wasn't a prob as below as they were kept in the scipt itself.
>
> but I would like to be able to create my txt file from a dbase or excel
> prog and update the file when I need to without editing the main file.
>
> Any ideas would be appreciated.
>
> Lee Fortnam
> lee@sozo.co.uk
300 lines isn't that much. Below you see a way of how to retrieve the
information. You can add to your file by appending, and you can speed up
modifying by having, say, an index file.
while (<DATA>) {
chomp;
($key, $description) = split /,/;
$items{$key} = $description;
}
foreach $item(sort keys %items) { print "$item -> $items{$item}\n"; }
__DATA__
item01,00001#Item 1 description#12.00#21.50
item02,00021#Item 2 description#16.00#31.32
item03,04001#Item 3 description#22.00#41.23
item04,00201#Item 4 description#27.00#51.76
item05,00211#Item 5 description#33.00#61.48
item06,10001#Item 6 description#12.00#21.50
item07,10021#Item 7 description#16.00#31.32
item08,14001#Item 8 description#22.00#41.23
item09,10201#Item 9 description#27.00#51.76
item10,10211#Item 10 description#33.00#61.48
item11,P&P#Postage and Packing#5.00#8.00
item12,Ins#Optional Delivery Insurance#3.00#5.00
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 22 Jul 1998 12:12:10 GMT
From: "Mathijs Oosterom" <thijs@esense.nl>
Subject: removing a line from a textfile
Message-Id: <01bdb569$f29b4ee0$a44a6dc2@earl.esense.nl>
Hi,
Can anybody tell me how to remove one line from a textfile with Perl? And
which filehandle should I use?
Thanks,
Thijs.
------------------------------
Date: Wed, 22 Jul 1998 13:19:31 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: removing a line from a textfile
Message-Id: <35B5D8D3.C7979FD5@nortel.co.uk>
Mathijs Oosterom wrote:
> Can anybody tell me how to remove one line from a textfile with Perl? And
> which filehandle should I use?
This is perlfaq5:
How do I change one line in a file/delete a line in a file/insert a line
in the middle of a file/append to the beginning of a file?
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Wed, 22 Jul 1998 11:29:50 GMT
From: martin_harriss@my-dejanews.com
Subject: Reversing time
Message-Id: <6p4ife$6kg$1@nnrp1.dejanews.com>
How can I turn a given date in the dd mmm yyyy form into the internal time
format as returned by the time function? I need to be able to compare the
time written in a file with the current time.
Martin Harriss
Cambridge
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 22 Jul 1998 13:47:42 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Reversing time
Message-Id: <7x67gqp0o1.fsf@fidelio.vcpc.univie.ac.at>
Re: Reversing time, martin <martin_harriss@my-dejanews.com>
said:
martin> How can I turn a given date in the dd mmm yyyy form
martin> into the internal time format as returned by the
martin> time function? I need to be able to compare the
martin> time written in a file with the current time.
check CPAN for the modules:
Date::DateCalc
Date::Manip
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | personal email:
Stupid! Stupid!" ~ Eros, Plan9 fOS. | tony_curtis32@hotmail.com
------------------------------
Date: Wed, 22 Jul 1998 12:29:10 GMT
From: mrauschkolb@my-dejanews.com
Subject: Re: slick ideas that don't work
Message-Id: <6p4lum$akr$1@nnrp1.dejanews.com>
put the i after the second slash:
@results = grep(/$search/i,@indata);
In article <6p0hjn$vgs$1@nnrp1.dejanews.com>,
tdeering@my-dejanews.com wrote:
> When I want grep to ignore case (upper or lower case) I add the -i flag. But
> where do I put the flag in the following Perl line?
>
> @results = grep(/$search/,@indata);
>
> If Perl's grep can't do this, then is there an alternative?
>
> Tom
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 21 Jul 1998 11:55:16 -0800
From: Jake Gauthier <jake@net10.net>
Subject: Socket
Message-Id: <35B4F224.1889@net10.net>
I am having the worst time with sockets on win32. I am abled to open a
socket to an smtp server and send to proper commands to send an email.
However, when I try to connect to a POP3 server or a telnet server or
anything else when I try to read from the socket my perl stops dead. I'm
using build 316.
Here's one of my attempts......
#tcp-client
( $them, $port ) = @ARGV;
$port = 25 unless $port;
$them = 'smtp.metro.net' unless $them;
$AF_INET = 2;
$SOCK_STREAM = 1;
$SIG{'INT'} = 'dokill';
sub dokill {
kill 9,$child if $child;
}
$sockaddr = 'S n a4 x8';
#chop($hostname = `hostname`);
($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$port) = getservbyname($port,'tcp')
unless $port =~ /^\d+$/;;
($name,$aliases,$type,$len,$thisaddr) =
gethostbyname($hostname);
($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);
if (socket(S, $AF_INET, $SOCK_STREAM, $proto)) {
print "socket ok\n";
}
else {
die $!;
}
if (bind(S, $this)) {
print "bind ok\n";
}
else {
die $!;
}
if (connect(S,$that)) {
print "connect ok\n";
}
else {
die $!;
}
select(S); $| = 1; select(STDOUT);
$a=<S>;print "$a";
while( $b=<STDIN> ) {
print S "$b\n";
$a=<S>;print "$a";
}
exit 1 ;
It works as is but if I change the $port and $them I can't read from
<S>.
Any ideas?
------------------------------
Date: Wed, 22 Jul 1998 12:41:53 GMT
From: horseyride@hotmail.com
Subject: SPLIT help please
Message-Id: <6p4mmh$bfd$1@nnrp1.dejanews.com>
Can someone tell me how to do split commands for weird characters? I have two
splits, one where I want to split on a '.' (decimal) and one on a '|' (pipe
character). Thanks
Adam
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 22 Jul 1998 14:02:06 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: system("grep edu list|wc -l>a")
Message-Id: <is3ebugkld.fsf@godzilla.kiere.ericsson.se>
alexYPchiu@hotmail.com writes:
> I have a mailing list. And I try to calculate the number of subscribers
> in different groups, ie .edu, .com, etc. For shell, I can do it easily
> with "grep .edu LISTNAME|cw -l". But I don't know how to do it using perl.
Here's a script I've had lying around for a couple of years. It wants
to grovel through a typical mailing-list distribution file (that is,
one email address per line). Once you figure out how it works (it
isn't that hard) you will know much more about Perl than you do now.
#!/usr/bin/perl
while(<>)
{
chop;
tr/A-Z/a-z/;
@a=split(/\./,$_);
$s{$a[$#a]}++;
}
foreach (sort {$s{$b} <=> $s{$a}} keys %s) {
printf "%s:\t%d\n",$_,$s{$_};
}
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Wed, 22 Jul 1998 12:34:51 GMT
From: mrauschkolb@my-dejanews.com
Subject: Re: Tcl is better than Perl
Message-Id: <6p4m9b$b05$1@nnrp1.dejanews.com>
Read all about it here:
http://language.perl.com/versus/index.html
In article <6p0f8n$3ks$1@nntp.Stanford.EDU>,
kinkoi@leland.Stanford.EDU (Kin-Koi Lo) wrote:
> Hi,
>
> I am going to write script programe so that the server can talk to my client
programe. People told me it is better to use Tcl instead of Perl. I only know
Perl and know nothing about Tcl. Would anyone tell me which is better?
>
> Thanks,
> Kinkoi
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 22 Jul 1998 06:27:20 GMT
From: "Steve Brooke" <spbrooke@bbag.demon.co.uk>
Subject: Re: Trouble with ActiveState - urgent
Message-Id: <01bdb53a$00aa3fd0$63c8200a@nelsa500>
> Ulf Wendel wrote in message <35A5C3D1.98157818@kiel.netsurf.de>...
> >Hi!
> >
> >I've lot's of trouble with the ActiveState Perl Version (NT, Build 316).
> >I simply can't include any CPAN modules - and my chief is getting
> >impatient... The latest error message was: "Can't find loadable object
> >in module... " It occurs when I type a simple "use Win32::ODBC;". @INC
> >is modified to look in the current working directory for modules.
> >Thanks!
> >
> >Ulf Wendel
> >
Hi,
I got Win32::ODBC working OK with ActiveState version. Have you put the
ODBC.PLL file in the correcct place. I seem to remeber getting this message
when I install wrong.
>From README
IF YOU ARE USING PERL BUILDS 303 OR HIGHER (Perl 5.003):
Copy BETA\lib\auto\win32\odbc\odbc.pll to
your perl directory\lib\auto\win32\odbc\odbc.pll
Steve
------------------------------
Date: Wed, 22 Jul 1998 12:42:09 +0200
From: Mauro Quartini <mauro@franchisetech.com>
Subject: verifying urls without download them
Message-Id: <35B5C201.5898@franchisetech.com>
Hi lists,
I have the following problem:
I need to check a great number of urls (pointing to html pages) and i
use the LWP::Simple library; this means i must download the whole
content of all pages (too much time expensive).
I dont need the html page contents, i need only to know if the url is
reacheable and (if yes) its last modification date.
I tried with LWP::Simple::head, but it doesn't work with all http
serves.
Does everyone know how to solve this problem or where to look for?
Thank you very much all
Mauro Quartini
------------------------------
Date: Wed, 22 Jul 1998 09:29:41 GMT
From: birgitt@my-dejanews.com
Subject: Re: Web Components
Message-Id: <6p4be4$sdo$1@nnrp1.dejanews.com>
In article <6p3e8f$f1h$1@srv38s4u.cas.org>,
lvirden@cas.org wrote:
>
> : I've seen calls to boycott Amazon in the past, but I had not seen
>
> good grief - I've seen similar postings pointing to Barnes and Nobel,
> Computer Literacy, etc.
>
> Was there something in the header that pointed specifically to originating
> from an employee of Amazon? If not, then why in the world would someone
> boycott them because an author pointed to an amazon book URL? Seems like
> a Barnes and Nobel employee might benefit from such a boycott, or even
> from making a posting which resulted in such a boycott...
If someone posts a book announcement to a NG and asks to buy the book
at place xyz, I would consider that SPAM for the book (only if it is
not a Perl book of course, if the NG is clpm - I assume Perl book
announcements are acceptable), but for the place to buy from.
If someone responds then and asks to boycott place xyz, but suggests
instead to buy at place uvw, that is IMHO also SPAM for place uvw.
That's the only reason I posted a comment at all in this thread.
In many cases people who ask for buying books at Amazon are the ones
who are associcates of Amazon. Any website owner who enhances his site
with a couple of specific books for which he hopes to earn a samll
commission by selling them through Amazon. These people are neither
bookstore owners, nor online booksellers, they are simple folks who
want to make a dollar with their websites. They can do the same in
becoming associates with Barnes & Nobles, or Borders (I think) and
with a couple of other online booksellers.
As the original poster mentioned his own original URL and then
the AMAZON URL, he is most probably an AMAZON associate. The
responisble SPAMMER would be he, not necessarily AMAZON. But that's
a wild guess. We don't know who the poster was.
Birgitt Funk
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 21 Jul 1998 20:49:13 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: What is Value of <HANDLE> ?
Message-Id: <peg3p6.9k6.ln@localhost>
Lavoie Philippe (lavoie@zeus.genie.uottawa.ca) wrote:
: In my program I get a lot (4) of this message
: Value of <HANDLE> construct can be "0"; test with defined() at cppdoc.pl line 65535.
: Any help on that matter would be appreciated.
All of the messages that perl might issue are explained in
the 'perldiag' man page.
-------------------------------
=item Value of %s can be "0"; test with defined()
(W) In a conditional expression, you used <HANDLE>, <*> (glob), C<each()>,
or C<readdir()> as a boolean value. Each of these constructs can return a
value of "0"; that would make the conditional expression false, which is
probably not what you intended. When using these constructs in conditional
expressions, test their values with the C<defined> operator.
-------------------------------
This message is most often due to something like:
while ( $line = <> )
perl is telling you that with some input, you may exit the loop
prematurely. It wants you to do it this way instead:
while ( defined($line = <>) )
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3222
**************************************