[11969] in Perl-Users-Digest
Perl-Users Digest, Issue: 5569 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 5 11:07:15 1999
Date: Wed, 5 May 99 08:00:23 -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, 5 May 1999 Volume: 8 Number: 5569
Today's topics:
Re: Controlling Serial Control Lines? (Bbirthisel)
Directory Usage <"Pep Mico"@hp.com>
Re: Dumb Question <eike.grote@theo.phy.uni-bayreuth.de>
Re: Dumb Question <ludlow@us.ibm.com>
Re: Dumb Question (Larry Rosler)
Re: having problems getting this script to work... (Bart Lateur)
Re: having problems getting this script to work... (Marko R. Riedel)
Re: having problems getting this script to work... (Marko R. Riedel)
Re: having problems getting this script to work... (Marko R. Riedel)
Help <barnauld@online.fr>
Re: how do I slurp a file into a string <eike.grote@theo.phy.uni-bayreuth.de>
HTML-code in textarea jajacek@my-dejanews.com
Re: HTML-code in textarea dzuy@my-dejanews.com
Re: I can not use cgi in my Hypermart account. <gellyfish@gellyfish.com>
Re: installing APi507e.exe on Win 95 <Matija.Exel@lag.ensieg.inpg.fr>
Is there a way how to turn a PERL program into ane EXE blazek@sisblansko.cz
Re: Is there a way how to turn a PERL program into ane <fbart@sprynet.com>
Re: ISPs that offer cgi space?? <dgris@moiraine.dimensional.com>
Java and Perl <Philippe.Emeriau@sophia.siemens-scg.com>
Re: mkdir on NT <ebohlman@netcom.com>
Re: mkdir on NT <gellyfish@gellyfish.com>
Ms Access database <marcov@ctrl-v.nl>
Re: must be better way (Randal L. Schwartz)
Re: Newbie having problems getting this script to work. mriedel@neuearbeit.de
Re: Perl 5: The Complete Reference, Martin Brown (Randal L. Schwartz)
Re: perl file "busy"? how can that be? (Sarch)
Re: Perl in the workplace sstarre@my-dejanews.com
Re: Perl in the workplace (Steve Linberg)
Re: Perl vs Java kucerar@hhmi.org
procedure to convert sec to HH:MM:SS format <godzila@freemail.nl>
Re: procedure to convert sec to HH:MM:SS format (Larry Rosler)
Read vs. <STDIN> <vvb@ibm.net>
Re: Read vs. <STDIN> (Larry Rosler)
Re: Reading extremely large files a chunk at a time <ebohlman@netcom.com>
Re: Reading extremely large files a chunk at a time (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 May 1999 13:39:30 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Controlling Serial Control Lines?
Message-Id: <19990505093930.07671.00002639@ng-fe1.aol.com>
Hi Rip:
> Tomorrow I have to do some interface testing of an RS-232 interface.
>I am on a Linux system, the other end is SCO. The SCO box passes data
>based upon hardware flow control.
>
>I see that there is a Windows CommPort module, but is there a
>module/method
>for manipulating the control lines under Unix (RedHat 5.2 specifically)?
The is a non_yet_complete clone of the Windows SerialPort and
CommPort modules that uses POSIX.pm to replace the Win32 API
calls. It is currently "alpha" code - and not posted separately although
it is included in some packages that need a "portable serial user
interface". Contact me directly if you would like a copy (even if just
as a POSIX.pm example).
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: Wed, 05 May 1999 16:25:49 +0200
From: Pep Mico <"Pep Mico"@hp.com>
Subject: Directory Usage
Message-Id: <373054ED.32FF994C@hp.com>
Hello,
How can I query what is the used space by a folder/directory in Windows
NT?
I've tried to use FilesystemObject from WSH, but it has a limitation
reporting huge Sizers (more than 50Gbytes)
The following lines only works if Folder or directory are small or
medium size, it doesn't work for Huge Volumes.
$fso= Win32::OLE->new ('Scripting.FileSystemObject') || die $!;
$folder=$fso->GetFolder("\\\\server\\ShareName");
print $folder->{'size'};
There are any Win32 Module that may help me?
Thanks in advance
pep_mico@hp.com
------------------------------
Date: Wed, 05 May 1999 15:26:43 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Dumb Question
Message-Id: <37304713.9857F1B7@theo.phy.uni-bayreuth.de>
Hi,
Jody Fedor wrote:
>
> my $query = $ENV{'QUERY_STRING'};
> ???????? $query =~ s/&*//; ??????????
> $query =~ s/s=//;
> $query =~ s/%[0-9a-fA-F]{2}/ /g;
> my @words = ($query =~ /\w+/g);
>
> OK, a dumb question, I'm trying to ignore anything in the query string after
> &
>
> The ????? line did not remove or truncate the rest of the string like i
> wanted it to.
>
> What I'm receiving from the browser:
> http://www.???.???/cgi-bin/search.pl?s=epson+ribbons&x=30&y=11
What does your solution ('/&*/') search for ? It looks for zero or
more &'s in your string. The first thing Perl encounters in its search
is "zero &'s", which is just fine, so Perl replaces "no &" with
"nothing"...
What you want is an "&" followed by some text. This can be achieved
by using /&.*/ as a search pattern. This will find an "&" followed
by something of length zero - still not what you want.
The final solution would be a pattern like this: /&.*$/
"Search for an '&' followed (maybe) by some characters until the end
of the string."
> Just another dumb question from someone trying to learn while doing.
>
> Thanks in advance for the help.
Bye, Eike
--
=======================================================================
>>--->> Eike Grote <eike.grote@theo.phy.uni-bayreuth.de> <<---<<
-----------------------------------------------------------------------
Home Page, Address, PGP,...: http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
PGP fingerprint: 1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================
------------------------------
Date: Wed, 05 May 1999 08:48:57 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Dumb Question
Message-Id: <37304C49.5226CC33@us.ibm.com>
Jody Fedor wrote:
>
> Another Dumb Question...
> I have Active State Perl on my Win 95 machine... How do i get the
> perlre manpages?
perldoc perlre
And while you're at it...
perldoc perldoc
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: Wed, 5 May 1999 07:25:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Dumb Question
Message-Id: <MPG.1199f4a7a57958ff9899cb@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37304713.9857F1B7@theo.phy.uni-bayreuth.de> on Wed, 05 May
1999 15:26:43 +0200, Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
says...
...
> What you want is an "&" followed by some text. This can be achieved
> by using /&.*/ as a search pattern. This will find an "&" followed
> by something of length zero - still not what you want.
>
> The final solution would be a pattern like this: /&.*$/
> "Search for an '&' followed (maybe) by some characters until the end
> of the string."
These mean the same thing. You have overlooked that '*' is greedy.
Thus /&.*/ matches an '&' followed by as many non-newline characters as
possible. As '$' matches the end of the string or before a newline that
is at the end of the string, /&.*$/ matches the same string as /&.*/
does.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 05 May 1999 13:32:13 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: having problems getting this script to work...
Message-Id: <3732459a.2245224@news.skynet.be>
Hawkwynd wrote:
>$file_dir = "C:/wp";
>opendir DIR,$file_dir or die "Error: unable to open $file_dir:$!";
># Open the directory
>my @myarray = (readdir(DIR));
># Get my array list of files in dir
>print map {"$_\n" } @myarray;
Works, but is a bit weird. Try setting $\ and $, both to "\n", and then
simply print the array.
{
local($\,$,) = ("\n","\n");
print @myarray;
}
># list the files on the screen
>close DIR;
># Close the dir
Oops. That must be
closedir DIR;
>To this point, I've created an array that holds the filenames in the c:/wp
>folder.
>
>Next step, is to be able to open each text file listed in the array, to
>perform a search and replace:
>
>foreach (@myarray) {
>
>Open the file, for read, and assign the data in that file to a variable:
>
>open(INF," $Iamlosthere")
A) Don't forget to prepend the directory in front of the filename
B) Read the files, using <INF>
>Basically, I'm trying to be able to read the files one by one in a
>directory, which are all .txt files.
Just makje sure you ONLY use the text files, e.g. by using grep on the
array.
foreach(grep { /\.txt$/i } @mayarray) {
open(INF,"$file_dir/$_"); # What? No error checking!?! ;-)
while(<INF>) {
...
}
}
>Within each file contains two
>characters that have to be removed, afterwards, saving each file without the
>.TXT extension and trimming off the 1st 3 letters of the filename.
>Example:
>in the dir are:
>
>33_1234.txt
>33_1235.txt
>and so on...
>
>Open file, and remove ascii char 13 and 14, which appear as the male sex
>symbol in ASCII editor, and the note character.
tr/\015\016//d; # 13 and 14 in octal
>Then save the file like:
>
>1234
>1235
You need pattern matching on the filename. Instead of the grep() as
above, you can do (untested):
foreach (@myarray) {
next unless /^\d{2}_(\d{4})\.txt$/i;
open(INF,"$file_dir/$_"); # check open!
open(OUTF,">$outdir/$1"); # check open!
while(<INF>) {
# Kill the gremlins
tr/\015\016//d;
print OUTF;
}
}
Bart.
------------------------------
Date: 05 May 1999 14:52:29 +0200
From: mriedel@neuearbeit.de (Marko R. Riedel)
Subject: Re: having problems getting this script to work...
Message-Id: <lzg15bllv6.fsf@linux_sexi.neuearbeit.de>
#! /usr/bin/perl
#
$toprocess='/tmp';
opendir(DIR, $toprocess);
@files = grep {
/^33_(.*)\.txt$/; $_=$1; defined($1);
} readdir(DIR);
closedir DIR;
undef $/;
map {
$src="$toprocess/33_$_.txt"; $dst=">$toprocess/$_";
open(SRC, $src);
$data=<SRC>; $data =~ s/[\015\016]//gs; # octal
close(SRC);
open(DST, $dst);
print DST $data;
close(DST);
} @files;
------------------------------
Date: 05 May 1999 14:06:45 +0200
From: mriedel@neuearbeit.de (Marko R. Riedel)
Subject: Re: having problems getting this script to work...
Message-Id: <lziua7lnze.fsf@linux_sexi.neuearbeit.de>
#! /usr/bin/perl
#
$toprocess='/tmp';
opendir(DIR, $toprocess);
@files = grep {
/^33_(.*)\.txt$/; $_=$1; defined($1);
} readdir(DIR);
closedir DIR;
undef $/;
map {
$src="$toprocess/33_$_.txt"; $dst=">$toprocess/$_";
open(SRC, $src);
$data=<SRC>; $data =~ s/[\015\016]//gs; # octal
close(SRC);
open(DST, $dst);
print DST $data;
close(DST);
} @files;
------------------------------
Date: 05 May 1999 14:49:45 +0200
From: mriedel@neuearbeit.de (Marko R. Riedel)
Subject: Re: having problems getting this script to work...
Message-Id: <lzhfprllzq.fsf@linux_sexi.neuearbeit.de>
#! /usr/bin/perl
#
$toprocess='/tmp';
opendir(DIR, $toprocess);
@files = grep {
/^33_(.*)\.txt$/; $_=$1; defined($1);
} readdir(DIR);
closedir DIR;
undef $/;
map {
$src="$toprocess/33_$_.txt"; $dst=">$toprocess/$_";
open(SRC, $src);
$data=<SRC>; $data =~ s/[\015\016]//gs; # octal
close(SRC);
open(DST, $dst);
print DST $data;
close(DST);
} @files;
------------------------------
Date: Wed, 05 May 1999 17:58:11 +0200
From: XX <barnauld@online.fr>
Subject: Help
Message-Id: <37306A93.BBD8B827@online.fr>
How can i do a perl script that launch an another perl script when a
specify files is created in a specified folder ?
Please
------------------------------
Date: Wed, 05 May 1999 15:31:49 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: how do I slurp a file into a string
Message-Id: <37304845.D48CC7A5@theo.phy.uni-bayreuth.de>
Hi,
What's your problem ? Hmm... let's take a guess...
tbrannon wrote:
>
> #!/usr/bin/perl
>
> system "rm -f joblist.asp";
> system "wget http://registry.yosemite.cc.ca.us/JobBank/joblist.asp";
>
> open J, "joblist.asp";
^
Here your filehandle is 'J'.
>
> ## HERE: I want to slurp the file into $file_contents in one line of Perl.
>
> $file_contents='';
> while (<F>) {
^
Now we have 'F'.
> $file_contents = $file_contents . $_;
> }
>
> --
> Terrence Brannon * brannon@lnc.usc.edu * http://lnc.usc.edu/~brannon
> (213) 740-3397 [office] (323) 294-3028 [home]
So, check your filehandles and come back, if you still have problems.
Bye, Eike
--
=======================================================================
>>--->> Eike Grote <eike.grote@theo.phy.uni-bayreuth.de> <<---<<
-----------------------------------------------------------------------
Home Page, Address, PGP,...: http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
PGP fingerprint: 1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================
------------------------------
Date: Wed, 05 May 1999 14:33:10 GMT
From: jajacek@my-dejanews.com
Subject: HTML-code in textarea
Message-Id: <7gpkr6$if6$1@nnrp1.dejanews.com>
A user must put HTML-code in textarea field. This code will be a part of
HTML-page. How can I this easy make? And how can I validate this input?
Perl-module, applet?
Jacek
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 05 May 1999 14:42:29 GMT
From: dzuy@my-dejanews.com
Subject: Re: HTML-code in textarea
Message-Id: <7gplck$j0f$1@nnrp1.dejanews.com>
In article <7gpkr6$if6$1@nnrp1.dejanews.com>,
jajacek@my-dejanews.com wrote:
> A user must put HTML-code in textarea field. This code will be a part of
> HTML-page. How can I this easy make? And how can I validate this input?
>
> Perl-module, applet?
>
> Jacek
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
I wrote a module that parses HTML form. If anyone is interested, let
me know. If I get lots of response, I'll consider making public.
Dzuy
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 5 May 1999 14:13:18 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I can not use cgi in my Hypermart account.
Message-Id: <373043ee@newsread3.dircon.co.uk>
Austin Ming <austin95002887@yahoo.com> wrote:
>
<snip>
> But, I can not run the cgi.
>
> http://heshe.hypermart.net/cgi-bin/html.pl
>
>
> What's wrong ? Can anyone help me ?
>
Did you look at the Error Log - I did , there is a nice link to it on the
500 error page :
Errors:
exec of /data1/hypermart.net/heshe/cgi-bin/html.pl failed, reason:
No such file or directory (errno = 2)
I would say that you have got the path to your Perl wrong in your
shebang line - I cant tell what it should be but you could ask
someone at hypermart.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Wed, 05 May 1999 14:32:38 +0200
From: Matija Exel <Matija.Exel@lag.ensieg.inpg.fr>
Subject: Re: installing APi507e.exe on Win 95
Message-Id: <37303A65.A5A34A87@lag.ensieg.inpg.fr>
well i'm back to sum up, after new tests:
-- installing APi507e.exe and APi515e.exe on a Win 95 PC
-- several PCs were tried, with 16 32 and 64 Mbytes of RAM; 486 and
Pentium S 166 processors
-- the only program running was the Perl installer
-- Jonathan: no duplicate PerlEz.dll
-- PROBLEM: just after "Configuring Active Perl. This may take a minute."
and then while
"Configuring Perl..." an error window for _INS0432 pups up and
the Debug information is:
_INS0432 a causi une difaillance de page dans le module PERLEZ.DLL `
0137:00c11085....
(_INS0432 caused a page fault within the module PERLEZ.DLL at...)
The installation apparently completes without problems, and my CGI scripts
are running OK, so far...
Question: do I have to worry?
A couple of fishy facts may point to the DCOM stuff, which must be
preinstalled for Win 95:
--> When starting the Perl installer on a Win95 without Dcom95 OR even WITH
Dcom98, version 1.0!!, it asks for
the installation of DCOM 1.2 from
http://www.microsoft.com/com/dcom/dcom1_2/default.htm
==> this information plainly needs updating: the address is false and
the current version is Dcom 1.3
--> I therefore downloaded dcom95.exe, ie. DCOM 1.3 for Win95 from
http://www.microsoft.com/com/resources/downloads.asp. No previous
version was available.
(then I restarted the Perl installer, with the results above)
So either the Perl installer needs updating for DCOM 1.3 or the latter has
bugs or ....
------------------------------
Date: Wed, 05 May 1999 13:33:55 GMT
From: blazek@sisblansko.cz
Subject: Is there a way how to turn a PERL program into ane EXE file?
Message-Id: <7gphc3$fak$1@nnrp1.dejanews.com>
As far as I know there are two products for turning a Perl script into an exe
file
1. PDK from Active state that runs on NT only. So, it is not for me
as I have Windows 95 and I did not try it.
2. Perl2exe that I tried but the exe file I received is not functioning. I
asked the support for help this Monday and they did try to help me
but it did not work either.
Is there any other , working, product?
Thank you for help
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 05 May 1999 10:08:16 -0400
From: vepxistqaosani <fbart@sprynet.com>
To: blazek@sisblansko.cz
Subject: Re: Is there a way how to turn a PERL program into ane EXE file?
Message-Id: <373050D0.6CF15912@sprynet.com>
Blazek
I recently tried the same thing on Win95, also with no success.
I just translated my Perl to C and compiled that; it took me less time than I had
spent fiddling with p2x.
I do seem to recall a warning that p2x is a pre-alpha release ...
Fred
$_="ustJay notherAay ewNay erlPay ackerHay";s/(\w+?)(\w)ay/$2$1/g;print;
blazek@sisblansko.cz wrote:
> As far as I know there are two products for turning a Perl script into an exe
> file
> 1. PDK from Active state that runs on NT only. So, it is not for me
> as I have Windows 95 and I did not try it.
> 2. Perl2exe that I tried but the exe file I received is not functioning. I
> asked the support for help this Monday and they did try to help me
> but it did not work either.
> Is there any other , working, product?
> Thank you for help
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 05 May 1999 08:55:38 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: ISPs that offer cgi space??
Message-Id: <m3r9ovefbp.fsf@moiraine.dimensional.com>
TRG Software : Tim Greer <webmaster@chatbase.com> writes:
> > you want him to start comp.lang.perl.isp
>
> That'd be a GREAT idea! Then we can start comp.lang.perl.actinglessons
> and comp.lang.perl.crafts!
Don't forget comp.lang.perl.hampster.breeding.
> Perl WILL take over the world! :-)
Nah, it's the linux guys who are into World Domination[tm].
Perl hackers are happier letting the pitiful end-users of the
world squirm in eternal POB agony.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Wed, 05 May 1999 16:38:51 +0200
From: Philippe Emeriau <Philippe.Emeriau@sophia.siemens-scg.com>
To: Philippe.Emeriau@sophia.siemens-scg.com
Subject: Java and Perl
Message-Id: <373057FB.217D049B@sophia.siemens-scg.com>
Hi *,
does anyone know if it's possible to "link" a Java program with Perl ?
A simple example is a Perl programmer who can use an API, and this API
is implemented with Java.
This programmer does not know at all that he is using in fact Java ;-)
This kind of situation already exists for C and C++ and is named XS
stubs.
Thanks in advance for any help !
Please reply also to my email account in addition to the newsgroup ...
Philippe Emeriau.
Senior Software Engineer
Siemens HL Sophia Antipolis
Gaoa, 2600 Route des Crjtes
F-06560 Sophia Antipolis - FRANCE
Tel: (+33)(0)4 92 38 37 21
Fax: (+33)(0)4 92 38 37 99
Email: Philippe.Emeriau@sophia.siemens-scg.com
------------------------------
Date: Wed, 5 May 1999 13:22:49 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: mkdir on NT
Message-Id: <ebohlmanFB9H61.GHJ@netcom.com>
mcberio@my-dejanews.com wrote:
: I have a UNIX script which makes a directory, copies a template into it and
: fills it with user-input. I now want to run the script on NT with ActivePerl.
: I have code like:
: open(NEWDIR,"|mkdir $newdir") || print &Error('Sorry, cannot make directory');
: print NEWDIR $newdir;
: close(NEWDIR);
That's a rather bizarre way to create a directory. Perl has a built-in
mkdir() function: why not use it instead?
------------------------------
Date: 5 May 1999 15:06:57 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: mkdir on NT
Message-Id: <37305081@newsread3.dircon.co.uk>
mcberio@my-dejanews.com wrote:
> Hi,
>
> I have a UNIX script which makes a directory, copies a template into it and
> fills it with user-input. I now want to run the script on NT with ActivePerl.
>
> I have code like:
>
> #####
>
>
> open(NEWDIR,"|mkdir $newdir") || print &Error('Sorry, cannot make directory');
> print NEWDIR $newdir;
> close(NEWDIR);
> chmod(0777,"$newdir");
I've just got to know why you're doing it like this ? OK it works but
mkdir doesnt read from its STDIN so opening the pipe and printing to
it does nothing but execute the program.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Wed, 05 May 1999 16:22:47 +0200
From: Marco Vlemmings <marcov@ctrl-v.nl>
Subject: Ms Access database
Message-Id: <37305437.E2E7C6E5@ctrl-v.nl>
hi all,
I have a question about Ms Access. I want to write a perl script which
makes a '.mdb' file. Why would i make a '.mdb' file, because i don't
have a Window NT webserver but a Unix webserver. I want to know the
content of a 'mdb' file.Can someone help me?
Width kind regards,
Marco Vlemmings
email at work: marcov@ctrl-v.nl
email at home: m.vlemmings@goldmine.nl
------------------------------
Date: 05 May 1999 07:50:28 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: must be better way
Message-Id: <m1iua7a7uz.fsf@halfdome.holdit.com>
>>>>> "Ronald" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes:
Ronald> This would be a great place to use map in a non-void context!
Ronald> @new_array = map { ($x = $_) =~ s/\ +$// } @array;
Ronald> The /g is unnecessary, by the way. :)
Or, you can go much simpler than that:
@new_array = map /^(.*\S)/, @array;
Remember that m// returns $1 in a list context, which map is providing.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 05 May 1999 15:46:11 +0200
From: mriedel@neuearbeit.de
Subject: Re: Newbie having problems getting this script to work...
Message-Id: <lzemkvljdo.fsf@linux_sexi.neuearbeit.de>
#! /usr/bin/perl
#
$toprocess='/tmp';
opendir(DIR, $toprocess);
@files = grep {
/^33_(.*)\.txt$/; $_=$1; defined($1);
} readdir(DIR);
closedir DIR;
undef $/;
map {
$src="$toprocess/33_$_.txt"; $dst=">$toprocess/$_";
open(SRC, $src);
$data=<SRC>; $data =~ s/[\015\016]//gs; # octal
close(SRC);
open(DST, $dst);
print DST $data;
close(DST);
} @files;
------------------------------
Date: 05 May 1999 07:51:33 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl 5: The Complete Reference, Martin Brown
Message-Id: <m1emkva7t6.fsf@halfdome.holdit.com>
>>>>> "vepxistqaosani" == vepxistqaosani <vepxistqaosani@my-dejanews.com> writes:
vepxistqaosani> Randal, at the Boston tutorial last week, you said that you did technical
vepxistqaosani> reviews of new Perl books -- is this one of them?
Nope. Wasn't asked.
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 05 May 1999 14:42:48 GMT
From: aa@notreal.zip.com.au (Sarch)
Subject: Re: perl file "busy"? how can that be?
Message-Id: <3731581f.11851942@news.zip.com.au>
On 4 May 1999 21:04:16 GMT, larsot2@krypton.mankato.msus.edu (Timothy Larson)
wrote:
>Greetings!
>I've been all over the web now, trying to find out how a file can be
>busy. I've seen lots of stuff about multiple processes trying to access
>a file concurrently and how you can work around that, but that's not my
>problem.
Have you got the Perl script open up in a text editor/IDE at the same time
you're trying to execute the script via the server? It's possible that editor
has put a write lock on the file. But without any specific info on what
platform and web server you're using, it's hard to tell.
Sarch
--------------------------------------------------------------------------
Spamblock in action: Remove NOTREAL from email address to reply via email.
"Look, if that's where those poor children are, of course I'll go
to Somalia." - Amanda Keller, "The Hub"
------------------------------
Date: Wed, 05 May 1999 13:23:46 GMT
From: sstarre@my-dejanews.com
Subject: Re: Perl in the workplace
Message-Id: <7gpgou$ep3$1@nnrp1.dejanews.com>
Thanks so much for the replies. I tried to plead the case again with some of
your suggestions, and I got my answer. I'm dismissed. They're letting me work
through 30-June and then they said it's bon voyage to me and my non-conformist
attitude.
I'm a little distressed, but not so distressed as to capitulate and use VB
Script or NT.
Anyhow, thanks, I think you all are not only very helpful but also have the
right ideas about Perl and why it should be allowed.
On to greener pastures I hope :) I have a few weeks to find a Perl-friendly
workplace..
HUG,
S
In article <372F778C.2A9078DA@mail.cor.epa.gov>,
David Cassell <cassell@mail.cor.epa.gov> wrote:
> Ronald J Kimball wrote:
> >
> > David Cassell <cassell@mail.cor.epa.gov> wrote:
> >
> > > And point out the following:
> > > [1] Support is now guaranteed.
> > > www.ActiveState.com.PerlDirect [win32 & unix support]
> > > www.PerlClinic.com [the Perl Clinic]
> >
> > Also, www.PerlSupport.com, with the services of Chip Salzenberg.
>
> Oops. How did I overlook that one? Chip, if you're watching,
> all I have to say is "Mea culpa" and "Hikeeba!"
>
> David
> --
> David Cassell, OAO cassell@mail.cor.epa.gov
> Senior Computing Specialist phone: (541) 754-4468
> mathematical statistician fax: (541) 754-4716
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 05 May 1999 10:41:24 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl in the workplace
Message-Id: <linberg-0505991041240001@ltl1.literacy.upenn.edu>
In article <7gpgou$ep3$1@nnrp1.dejanews.com>, sstarre@my-dejanews.com wrote:
> Thanks so much for the replies. I tried to plead the case again with some of
> your suggestions, and I got my answer. I'm dismissed. They're letting me work
> through 30-June and then they said it's bon voyage to me and my non-conformist
> attitude.
Oh, man. I feel a little guilty here; I hope I didn't contribute to this.
However, although it sucks that this happened, I can't help but feel that
you don't want to work somewhere like that anyway. Really. It means form
is more important than substance to them, and your freedom to create is
basically non-existant. Remember that there's still a nationwide shortage
of skilled programmers that is only getting worse. The pointy-haired
managers will get what's coming to them.
I'd recommend that now that you're officially a lame-duck non-conformist
with nothing to lose, you use your remaining time to create some really
kick-ass Perl code that runs rings around their vb-whatever, just so they
can see how wrong they are. And if they see the light and offer to keep
you, demand a 50% raise.
> I'm a little distressed, but not so distressed as to capitulate and use VB
> Script or NT.
I'm truly sorry this happened to you, but I really do think you'll be
better off elsewhere.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 05 May 1999 13:29:07 GMT
From: kucerar@hhmi.org
Subject: Re: Perl vs Java
Message-Id: <7gph2v$euh$1@nnrp1.dejanews.com>
> I am working on a project that involves an object-oriented database.
> Unfortunately, this database could only talk to either a C++ or Java
You're doomed. Use Servlets.
-R
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 05 May 1999 15:29:38 +0200
From: peter <godzila@freemail.nl>
Subject: procedure to convert sec to HH:MM:SS format
Message-Id: <373047C2.907E678B@freemail.nl>
Hello,
Can some one tell me how can I convert sec to a normal time format
hh:mm:ss.
For example I have a perl script which put the output of a connection in
sec 603 in a variable.
Now I want to display this outcome in this format 00:10:03.
Thank you in advance for your help.
Peter
------------------------------
Date: Wed, 5 May 1999 07:46:12 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: procedure to convert sec to HH:MM:SS format
Message-Id: <MPG.1199f984e9aa623f9899cd@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <373047C2.907E678B@freemail.nl> on Wed, 05 May 1999 15:29:38
+0200, peter <godzila@freemail.nl> says...
> Can some one tell me how can I convert sec to a normal time format
> hh:mm:ss.
> For example I have a perl script which put the output of a connection in
> sec 603 in a variable.
> Now I want to display this outcome in this format 00:10:03.
printf "%.2d:%.2d:%.2d\n", $sec/3600, $sec%3600/60, $sec%60;
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 5 May 1999 15:28:47 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Read vs. <STDIN>
Message-Id: <37303863@news.uk.ibm.net>
Hi,
whenever you read on using Perl for CGI, this is the syntax used for reading
the input of a POST-ed form:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
This works, but when I just learned Perl (or rather: could modify scripts to
fit my needs :-) I could never remember this line. So I discoverd I could
also use:
$buffer=<STDIN>;
These two lines read both the same from STDIN - or in this case whatever the
user filled in in the form.
As these two lines seem to do the same, can anyone explain IF there is a
difference, and if so, what it is and which is better to use?
Thanks,
Vincent Vanbiervliet
http://learn.ibm.be
------------------------------
Date: Wed, 5 May 1999 07:38:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Read vs. <STDIN>
Message-Id: <MPG.1199f7c8438cad999899cc@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37303863@news.uk.ibm.net> on Wed, 5 May 1999 15:28:47 +0200,
Vincent Vanbiervliet <vvb@ibm.net> says...
> whenever you read on using Perl for CGI, this is the syntax used for reading
> the input of a POST-ed form:
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> This works, but when I just learned Perl (or rather: could modify scripts to
> fit my needs :-) I could never remember this line. So I discoverd I could
> also use:
> $buffer=<STDIN>;
> These two lines read both the same from STDIN - or in this case whatever the
> user filled in in the form.
>
> As these two lines seem to do the same, can anyone explain IF there is a
> difference, and if so, what it is and which is better to use?
There is a big difference if the input consists of more than one line.
The first (read) statement reads all of the input, while the second
(<STDIN>) reads the first line only.
By the way, the correct use of the first statement is:
if (read(STDIN, $buffer, $ENV{CONTENT_LENGTH}) != $ENV{CONTENT_LENGTH})
{
# Report an error and quit! For example, ...
print "Content-type: text/plain\n\nError reading input!\n";
exit;
}
If you're going to do your own CGI interface, do it right! But 'the
books' don't tell you this. :-(
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 5 May 1999 13:24:31 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Reading extremely large files a chunk at a time
Message-Id: <ebohlmanFB9H8v.GJw@netcom.com>
adam moore <paxamr@unix.ccc.nottingham.ac.uk> wrote:
: The individual file parser uses @inbuff=<INPUT> to read the file and then
: processes each line / group of lines with the same ID. The whole database
: is >200Mb, so I obviously can't use that any more. Is there any way to
: read each file up to "//" into @inbuff, then move on? My apologies if
: this is obvious/simple - I have done extensive web searching and can't
: seem to find an answer.
perldoc perlvar and look at the entry for $/.
------------------------------
Date: Wed, 5 May 1999 07:10:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Reading extremely large files a chunk at a time
Message-Id: <MPG.1199f126b5e31df49899ca@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <Pine.SOL.4.05.9905051303380.541-100000@granby> on Wed, 5 May
1999 13:15:41 +0100, adam moore <paxamr@unix.ccc.nottingham.ac.uk>
says...
> I have written a script to convert single files from a large flat file
> database into XML. Now I want to convert the whole database at one go.
> Each record is a series of lines 80 chars or less with a two letter ID tag
> at the start. The end of each record is given by "//" on a line on it's
> own (It's the SwissProt files http://www.expasy.ch, if you want to know).
>
> The individual file parser uses @inbuff=<INPUT> to read the file and then
> processes each line / group of lines with the same ID. The whole database
> is >200Mb, so I obviously can't use that any more. Is there any way to
> read each file up to "//" into @inbuff, then move on?
Look in perlvar for $/ ($INPUT_RECORD_SEPARATOR).
{
local $/ = "\n//\n";
while (<INPUT>) {
my @inbuff = split /\n/;
# process @inbuff here ...
}
}
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5569
**************************************