[19226] in Perl-Users-Digest
Perl-Users Digest, Issue: 1421 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 1 11:08:16 2001
Date: Wed, 1 Aug 2001 08:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <996678309-v10-i1421@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 1 Aug 2001 Volume: 10 Number: 1421
Today's topics:
active state and CGI? (zawy)
Re: active state and CGI? <Tassilo.Parseval@post.rwth-aachen.de>
Re: active state and CGI? <bart.lateur@skynet.be>
amount of array elements <manuel.koerner@rexroth.de>
Re: amount of array elements <Tassilo.Parseval@post.rwth-aachen.de>
ANNOUNCE: PerlPoint::Package 0.35, PerlPoint::Converter <perl@jochen-stenzel.de>
couldn't get sysseek/syswrite combination to overwrite (Balaji)
FAQ: How can I tell whether a list or array contains a <faq@denver.pm.org>
grepmail 4.50 released <newspost@coppit.org>
Re: Hard DBI question <member@dbforums.com>
Re: Having some trouble with map (John Joseph Trammell)
how to find free disk space (Win32) (John Stumbles)
Re: how to find free disk space (Win32) <paul.johnston@dsvr.co.uk>
Re: join lines ? <godzilla@stomp.stomp.tokyo>
Re: newbe question splitting a string into two differen (Anno Siegel)
newbie question about file concatenation <donnacha@ee.ucd.ie>
Re: newbie question about file concatenation <Tassilo.Parseval@post.rwth-aachen.de>
Re: newbie question about file concatenation <Tassilo.Parseval@post.rwth-aachen.de>
Re: OT: spelling (was Re: chess in perl) <holland@origo.ifa.au.dk>
Q: csh together with perl <Rainer.Theuer@sci-worx.com>
question on Here documents <strawSPAM_BEGONEman@plexi.com>
Regex Question... (JR)
Re: Reporting Questionable Programming Activity <rwoodman_nospam_@verio.net>
Script works on PWS but not IIS? (Alex)
Re: sending email problems in CGI <frank@cs.nchu.edu.tw>
Re: Splitting Peculiar HTML <hermann@holzerath.de>
system function problems <666.diablo@wanadoo.fr>
Re: Telnet/MUD server <iltzu@sci.invalid>
temp files <blnukem@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 01 Aug 2001 14:00:45 GMT
From: zawy@yahoo.com (zawy)
Subject: active state and CGI?
Message-Id: <3b680af3.88400616@news.mindspring.com>
How do I use active state and cgi? I mean, how do I use Perl on my Windows
machine to accept form data from a browser and return output to the
browser?
------------------------------
Date: Wed, 01 Aug 2001 14:13:40 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: active state and CGI?
Message-Id: <3B67F274.6080403@post.rwth-aachen.de>
zawy wrote:
>How do I use active state and cgi? I mean, how do I use Perl on my Windows
>machine to accept form data from a browser and return output to the
>browser?
>
You most probably need a local-webserver to do that. Back in my
Windows-times, I used OmniHTTPD for this very purpose. It works quite
well along with ActiveState's Perl-distribution.
Have a look at http://www.omnicron.ab.ca/httpd/ .
As far as I remember, OmniHTTPD is free for personal use.
Tassilo
--
Women can keep a secret just as well as men, but it takes more of them
to do it.
------------------------------
Date: Wed, 01 Aug 2001 12:49:40 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: active state and CGI?
Message-Id: <j5ufmtktchn38o15re2irl7ejbmijnp5h5@4ax.com>
zawy wrote:
>How do I use active state and cgi? I mean, how do I use Perl on my Windows
>machine to accept form data from a browser and return output to the
>browser?
You need a web server. It may be a small one...
Apache is free, and likely the most used web server in the world.
<http://httpd.apache.org/docs/windows.html>
But if you're new to it, tweaking the configuration might be a bit
difficult. Activestate's competition, Indigoperl
(<http://www.indigostar.com/indigoperl.htm> comes with a precompiled and
preconfigured Apache server. That might be simpler.
There are others. I think Windows even comes with one: PWS. But people
don't seem to be too fond of it.
A minimal web server can be found at <http://www.ritlabs.com/tinyweb/>.
--
Bart.
------------------------------
Date: Wed, 1 Aug 2001 14:38:58 +0200
From: "Manuel Körner" <manuel.koerner@rexroth.de>
Subject: amount of array elements
Message-Id: <9k8t8o$189@sunny.mannesmann.de>
hi,
how can i get the amount of elements in a referenced
array???
In a normal array with $#array.
Thanks a lot
Manuel Körner
manuel.koerner@rexroth.de
------------------------------
Date: Wed, 01 Aug 2001 14:51:11 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: amount of array elements
Message-Id: <3B67FB3F.5010105@post.rwth-aachen.de>
Manuel Körner wrote:
>hi,
>
>how can i get the amount of elements in a referenced
>array???
>In a normal array with $#array.
>
No, that's not the amount but the index of the last element. The amount
would be scalar @array.
If you have a reference to an array, you have to dereference it first:
$ref = [qw(a b c)];
print $#{$ref}; # prints 2
print scalar @{$ref} ;# prints 3
Tassilo
--
If you think last Tuesday was a drag, wait till you see what happens tomorrow!
------------------------------
Date: Wed, 01 Aug 2001 08:32:37 +0200
From: Jochen Stenzel <perl@jochen-stenzel.de>
Subject: ANNOUNCE: PerlPoint::Package 0.35, PerlPoint::Converters 0.11
Message-Id: <tmg5etr78ckuf6@corp.supernews.com>
Hello,
new PerlPoint packages arrived at CPAN.
What's new?
Package:
* Lexer bugfix. I recommend to update.
* Platforms: it now runs with perl 5.005 (really! ;-)
and on Windows (out of the box, without a need to patch).
* Docs: extended and slightly reorganized. Added
"Gettings started (with PerlPoint)" and "How to write
a PerlPoint converter".
* Projectors: new demo converter producing slides
for Clinton Pierce's Perl Projector.
Converters:
* Bugfixes: bullet handling in TOC, docs.
* Box colors can be reset to their default now.
* Styles: style options can be overwritten by
commandline switches.
* New options, new template keywords
(TOP_BGCOLOR, BOT_BGCOLOR, ...).
* New page index.html produced to make it easy
to find a doc/presentation in the Web by just entering
the directory/path without filename (index.htm is the
default name and can be overwritten).
* And more ... (see the Changes file).
What is PerlPoint?
------------------
The PerlPoint format, initially
designed by Tom Christiansen, is intended to provide
a simple and portable way to generate slides without
the need of a proprietary product. Slides can be prepared
in a text editor of your choice, generated on a any platform
where you find perl, and presented by any browser which can
render the chosen output format.
To sum it up, Perl Point Software takes an ASCII text
and transforms it into slides written in a certain
document description language. This is, by tradition,
usually HTML, but you may decide to use another
target format like XML, SGML, TeX or whatever you want.
Currently there are converters to HTML, SDF, LaTex
and (as demo applications) POD and Clinton Pierce's
Perl Projector. Processing SDF or LaTex furtherly, you
can easily get PostScript, PDF, manpages, formatted text
and more, all from the same source.
Jochen
------------------------------
Date: 1 Aug 2001 06:33:38 -0700
From: srinivasanbala@netscape.net (Balaji)
Subject: couldn't get sysseek/syswrite combination to overwrite a line.e
Message-Id: <86e0f1f4.0108010533.5019a9ac@posting.google.com>
I am not sure this can be done.but by checking perl.com I am
trying.Please guide me on this. Thanks.
My methodology like this.
I am taking a form input and convert to params and then I have printed
to a file called "Results.dat" , like below
Mike,38,Male,Engineer,Texas,Austin,USA,08/01/01,10:56.
later if I want to overwrite austin to dallas(this information is also
submitted via the same form only), I am trying to use the following
info.
for this to happen, I have split the "Results.dat" and compared with
input PARAMS and found which line is to be changed and construct a
newline based on new info and use sysseek to bring the pointer to
start and use syswrite overwrite that line.
$linesread = 0;
while ($readline = <INPUTFILE> ) {
if ($readline =~ /Check Param values for a pattern/)
{
print "number of characters read so far :
$linesread\n";
chop;
@f = split /,/, $readline;
print "This is taken from input file\n";
print "$f[0],$f[1],$f[2],$f[3],$f[4],$f[5],$f[6],$f[7],$f[8],$f[9],$f[10],$f[11],$f[12]\n\n";
##Finding which line to be replaced
if ( ( $f[0] eq "$NAME" ) && ( $f[1] eq "$AGE" ) && ( $f[2] eq
"$SEX" ) && ( $f[3] eq "$PROFESSION" ) )
{ $newline =
"$f[0],$f[1],$f[2],$f[3],$STATE,$CITY,$COUNTRY,$mydate,$mytime";}
## counting number of characters read so far
$linesRead = $linesRead + length($readLine);
## split fields and store them in an array
$fields = ();
@fields = split(/,/, $readLine);
print "This is the line to be replaced\n";
print "$newline\n";
close(INPUTFILE);
$offsetlength = $linesread -
length($readline);
print " I am printing offsetlength :
$offsetlength";
open(INPUTFILE, "+< $Resultsfile") or die
"Cannot open\n";exit 0;
sysseek INPUTFILE, $offsetlength,0;
syswrite INPUTFILE, $newline,
length($newline);
close(INPUTFILE);
exit 0;
}
---------------------------------------------------------------------
In between, I gave print statements to browser and perfectly it does
the job , but it is not actually replacing the line of
file.Permissions are ok.
syntax check is also ok.I might have missed some quotes whiile copy
/paste, but my script passes teh syntax check and prints perfectly to
browser.like,
$linesread, $offsetlength,$newline and the line to be replaced etc..
Thanks
Balaji
------------------------------
Date: Wed, 01 Aug 2001 12:20:00 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How can I tell whether a list or array contains a certain element?
Message-Id: <QtS97.31$l_m.177779200@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How can I tell whether a list or array contains a certain element?
Hearing the word "in" is an *in*dication that you probably should have
used a hash, not a list or array, to store your data. Hashes are
designed to answer this question quickly and efficiently. Arrays aren't.
That being said, there are several ways to approach this. If you are
going to make this query many times over arbitrary string values, the
fastest way is probably to invert the original array and keep an
associative array lying about whose keys are the first array's values.
@blues = qw/azure cerulean teal turquoise lapis-lazuli/;
undef %is_blue;
for (@blues) { $is_blue{$_} = 1 }
Now you can check whether $is_blue{$some_color}. It might have been a
good idea to keep the blues all in a hash in the first place.
If the values are all small integers, you could use a simple indexed
array. This kind of an array will take up less space:
@primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31);
undef @is_tiny_prime;
for (@primes) { $is_tiny_prime[$_] = 1 }
# or simply @istiny_prime[@primes] = (1) x @primes;
Now you check whether $is_tiny_prime[$some_number].
If the values in question are integers instead of strings, you can save
quite a lot of space by using bit strings instead:
@articles = ( 1..10, 150..2000, 2017 );
undef $read;
for (@articles) { vec($read,$_,1) = 1 }
Now check whether "vec($read,$n,1)" is true for some "$n".
Please do not use
($is_there) = grep $_ eq $whatever, @array;
or worse yet
($is_there) = grep /$whatever/, @array;
These are slow (checks every element even if the first matches),
inefficient (same reason), and potentially buggy (what if there are
regex characters in $whatever?). If you're only testing once, then use:
$is_there = 0;
foreach $elt (@array) {
if ($elt eq $elt_to_find) {
$is_there = 1;
last;
}
}
if ($is_there) { ... }
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
04.40
--
This space intentionally left blank
------------------------------
Date: Tue, 31 Jul 2001 01:25:16 -0400
From: David Coppit <newspost@coppit.org>
Subject: grepmail 4.50 released
Message-Id: <tmg5f5o5oip9fc@corp.supernews.com>
Description:
- grepmail is a Perl program that searches a normal or compressed
mailbox (gzip, bzip2, or tzip) for a given regular expression and
returns those emails that match the query. It also supports searches
constrained by date and size.
Download:
- You can download grepmail 4.50 from CPAN:
http://www.cpan.org/authors/id/D/DC/DCOPPIT/grepmail-4.50.tar.gz
- Until the file propagates to the mirrors, you can use the following
URL: http://prdownloads.sourceforge.net/grepmail/grepmail-4.50.tar.gz
Changes in version 4.50:
- Added X-Draft-From to support newer versions of Gnus
A complete change log is at:
- ftp://grepmail.sourceforge.net/pub/grepmail/CHANGES
David
------------------------------
Date: 1 Aug 2001 11:04:15 -0500
From: mimi <member@dbforums.com>
Subject: Re: Hard DBI question
Message-Id: <3b681a6f$1@usenetgateway.com>
Hi,
Sorry I can't help but you have the solution to my problems. I want to
execute MSSQL stored procedures with input and output parameters with no
success. I'd really appreciate it if you gave me some tips,
Mimi
--
Posted via dBforums, http://dbforums.com
------------------------------
Date: 01 Aug 2001 14:27:57 GMT
From: trammell@bayazid.hypersloth.invalid (John Joseph Trammell)
Subject: Re: Having some trouble with map
Message-Id: <slrn9mg26l.cn3.trammell@bayazid.hypersloth.net>
On Wed, 01 Aug 2001 09:40:10 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
> John Joseph Trammell wrote:
>
> >What side effects are these? I've re-read 'perldoc -f map'; no
> >clue was imparted.
>
> LOL! There are none. map() doesn't have side effects by itself.
[snip]
D'oh! I guess I just heard people getting all riled up, and
thought there was some s00p3r s3kr1t "side effect" to map().
All I could think of was modifying the list in place, but
that didn't justify the heat.
Back to the OP's question: feel free to stick with map(), and
I don't think there's anything wrong with that piece of code.
Can you give us a line number on that error? And more of the
source code?
--
Never hit anyone with glasses. Instead, use your fist.
------------------------------
Date: 1 Aug 2001 03:41:26 -0700
From: jstumbles@bluearc.com (John Stumbles)
Subject: how to find free disk space (Win32)
Message-Id: <b65eb2a6.0108010241.119537fd@posting.google.com>
Is there a module? Or some fairly portable way to do this? On windoze
even grepping `dir` for 'bytes free' fails if the disk is empty :-(
My hack (below) is to create an empty file, repeat the `dir` then
delete the file - oh dear!
sub touch($);
sub drive_free_space($)
{
my $drive = shift ;
my $dir = `dir $drive`;
unless ($dir =~ /([\,\d]+) bytes free/m) # empty dir
{
touch ("$drive\\_T_E_M_P.123") ;
$dir = `dir $drive`;
DEBUG $dir;
unlink "$drive\\_T_E_M_P.123" ;
}
$dir =~ /([\,\d]+) bytes free/m or die "unable to get bytes free
from DIR $drive";
my $bytes = $1 ;
$bytes =~ s/\,//g ;
return $bytes
}
sub touch ($)
{
my $filename = shift or return ;
open (OUT, ">$filename") or die "Could not create file $filename -
$!\n";
close OUT ;
}
And what about unices?
In general this seems to be a rather glaring omission from perl's
generally overflowing toolkit of system admin resources :-( Any ideas?
--
John Stumbles
http://www.stumbles.org/John
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
------------------------------
Date: Wed, 01 Aug 2001 12:05:14 +0100
From: Paul Johnston <paul.johnston@dsvr.co.uk>
Subject: Re: how to find free disk space (Win32)
Message-Id: <3B67E26A.9958A6BC@dsvr.co.uk>
Hi,
> In general this seems to be a rather glaring omission from perl's
> generally overflowing toolkit of system admin resources :-( Any ideas?
Then how about adding your Windows code to CPAN's Filesys::DiskFree
which works for several versions of Unix?
There is in fact a portable way to determine the amount of free disk
space - keep writing to a file until the disk fills up! Not recommended
though, and will not work if quotas are enabled.
Some operating systems (e.g. FreeBSD) deliberately lie about the amount
of free space, to save 8% or so of the disk for emergencies.
Paul
------------------------------
Date: Wed, 01 Aug 2001 07:26:27 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: join lines ?
Message-Id: <3B681193.37E104F5@stomp.stomp.tokyo>
Tim wrote:
> Godzilla! wrote:
> > Tim wrote:
(snipped)
> > Post your code you have developed so far,
> > working or not, to show sincere effort on
> > your part. My preference is to help those
> > who help themselves.
> Below is my code, Could you please give me some suggestions to make it "better" ?
This second article of yours contradicts your original parameters
stated in your first article. You will do both yourself and the
reader a benefit by not changing your parameters with each posted
article. I find this to be exceptionally annoying and hints at
a deliberate troll effort.
For my test script below my signature, my chain2.txt is a precise
duplicate of your data as you posted; exact copy / paste method.
As you know, your code compiles, runs and fails to generate
the output you desire. It prints "scan length is" only. In
debugging code, it is usually a good idea to simplify your
code to a point where at least some or all of your data is
printed, then go from there.
You may incorporate a string length print into my script with
little effort, if you don't elect to change your parameters
once again.
This script you posted, although a good effort, contains a lot
of logic flow problems. Good advice would be to abandon your
current efforts and start fresh. It is clear you developed
very complex coding without stage development testing. It is
significantly logical to develop your code in small simple
blocks, testing each, then incorporate all your blocks into
one single script. To exemplify this notion, my script was
developed in more than a dozen stages before being finalized.
Here are some comments which may assist your thinking and your logic.
These comments closely reflect each stage of my script development.
&Clean_Up;
Create a sub-routine so selected perl core default variables
can be localized; no effect on code outside this routine.
local ($/) = ";";
Localize the input filehandle record separator.
local ($");
Localize and null the array list separator to avoid
a need to foreach loop print elements; no spaces.
$_ =~ tr/\n\\//d;
$_ =~ s/^\s+//;
Initial removal of newlines and left slash followed
by removal of leading spaces.
$line_title = substr ($_, 0, index ($_, '= "') + 3, "");
Grab, store and remove each line preface from input.
$_ =~ tr/A-Za-z ";//d;
Final removal of extraneous characters from input.
@Array = split (//, $_);
foreach $number (@Array)
{ $number = "$number,"; }
chop ($Array[$#Array]);
Format remaining numbers in input to have a trailing
comma after each, then chop off the very last comma.
After this, piece of cake; print and close. You may
include line length coding and print at this stage,
as an alternative.
I will remind you to not change your parameters with each
posted article. Doing this is rude, makes helping you more
difficult and, reduces a likelihood of receiving help.
My personal opinion is doing this smacks of a troll,
whom I would dearly enjoy smacking around.
Godzilla! Queen Of Smackers.
--
Be cautious about word wrap. Each line should
be a single line, including my printed results.
TEST SCRIPT:
____________
#!perl
print "Content-type: text/plain\n\n";
&Clean_Up;
sub Clean_Up
{
local ($/) = ";";
local ($");
open (INFILE,"chain2.txt");
while (<INFILE>)
{
$_ =~ tr/\n\\//d;
$_ =~ s/^\s+//;
$line_title = substr ($_, 0, index ($_, '= "') + 3, "");
$_ =~ tr/A-Za-z ";//d;
@Array = split (//, $_);
foreach $number (@Array)
{ $number = "$number,"; }
chop ($Array[$#Array]);
print "$line_title", @Array, "\";\n\n";
}
close (INFILE);
}
PRINTED RESULTS:
________________
chain "chain1" =
"0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1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,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0";
------------------------------
Date: 1 Aug 2001 14:06:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: newbe question splitting a string into two different variables
Message-Id: <9k92dt$9m7$1@mamenchi.zrz.TU-Berlin.DE>
According to Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>:
> Oliver wrote:
>
> >can an anonymous array have undefined length?
> >
>
> What is an undefined length? In Perl diction the length of an array is
> undefined, when it is 0.
Ahem. What Perl diction would that be? The length of an unassigned
array is zero, and it would be misleading to call it anything else.
Even when you "undef @x" (which is rarely the right thing to do),
it is 0 in scalar context.
> That is, even an anonymous array (or list)
> could have an undefined length:
No Perl array has an undefined length -- "defined scalar @x" is
always true.
[more about lists with undefined length snipped]
Anno
------------------------------
Date: Fri, 27 Jul 2001 15:23:42 +0100
From: Donnacha Daly <donnacha@ee.ucd.ie>
Subject: newbie question about file concatenation
Message-Id: <Pine.LNX.4.10.10107271520480.5440-100000@ee.ucd.ie>
hi
I have three files which together make a html file.
I want to concatenate them.
How do I do this, while
making sure there is a space between the
last word of one file and the first word of the next?
DD
------------------------------
Date: Wed, 01 Aug 2001 15:31:34 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: newbie question about file concatenation
Message-Id: <3B6804B6.8040007@post.rwth-aachen.de>
Donnacha Daly wrote:
>
>hi
>
>I have three files which together make a html file.
>I want to concatenate them.
>How do I do this, while
>making sure there is a space between the
>last word of one file and the first word of the next?
>
Well:
open FILE1, "file1";
open FILE2, "file2";
open FILE3, "file3";
open CONC, "concatenated_files";
print CONC <FILE1>, " ", <FILE2>, " ", <FILE3>;
BTW, you mean a space between them or a newline? In this case " " would
have to be replaced with "\n";
Tassilo
--
Kill Ugly Processor Architectures
- Karl Lehenbauer
------------------------------
Date: Wed, 01 Aug 2001 15:33:17 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: newbie question about file concatenation
Message-Id: <3B68051D.3090507@post.rwth-aachen.de>
Tassilo von Parseval wrote:
Sorry, little mistake:
> Well:
>
> open FILE1, "file1";
> open FILE2, "file2";
> open FILE3, "file3";
> open CONC, "concatenated_files";
should be:
open CONC, ">concatenated_files"; # for writing, not reading
--
"Consistency requires you to be as ignorant today as you were a year ago."
-- Bernard Berenson
------------------------------
Date: 01 Aug 2001 16:28:32 +0200
From: Steve Holland <holland@origo.ifa.au.dk>
Subject: Re: OT: spelling (was Re: chess in perl)
Message-Id: <w4766c7lur3.fsf@origo.ifa.au.dk>
Sami Jarvinen <if.xoboi@jks.invalid> writes:
> Speaking of spelling, why do some people sometimes say 'optomize'
> instead of 'optimize'?
There are two reasons. First, "optimise" is often pronounced
"optomise" and people whose native language is not English tend to
write words the way they are pronounced. The second reason is that
"o" is right next to "i" on most English keyboards (and many
non-English ones) so it is easy for a finger to slip.
=====================================================================
To find out who and where I am look at:
http://www.nd.edu/~sholland/index.html
Spammers: Please send spam to: abuse@aol.com and abuse@yahoo.com
=====================================================================
------------------------------
Date: Wed, 01 Aug 2001 13:22:55 +0200
From: Rainer Theuer <Rainer.Theuer@sci-worx.com>
Subject: Q: csh together with perl
Message-Id: <3B67E68F.33004255@sci-worx.com>
--------------8711B6F0E72825F60F86274A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi all,
i try to write a script which should replace a string in a given file .
The perl call has a problem with ENV variables , because the perl
call don't know the content.
Does anyone know whats wrong or how to solve my problem ?
Thanks
/Rainer
#!/bin/csh -f
setenv new $2
setenv old $1
setenv files $3
echo "replacing : $old --> $new in file $files "
perl -p -i.bak -e 's/$ENV{"old"}/$ENV{"new"}/g' $files
--------------8711B6F0E72825F60F86274A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<font color="#000000">Hi all,</font><font color="#000000"></font>
<p><font color="#000000">i try to write a script which should replace
a string in a given file .</font>
<br><font color="#000000">The perl call has a problem with ENV variables
, because the perl</font>
<br><font color="#000000">call don't know the content.</font><font color="#000000"></font>
<p><font color="#000000">Does anyone know whats wrong or how to solve my
problem ?</font><font color="#000000"></font>
<p><font color="#000000">Thanks</font><font color="#000000"></font>
<p><font color="#000000">/Rainer</font><b><font face="Courier New,Courier"><font color="#3333FF"></font></font></b>
<p><b><font face="Courier New,Courier"><font color="#3333FF">#!/bin/csh
-f</font></font></b><b><font face="Courier New,Courier"><font color="#3333FF"></font></font></b>
<p><b><font face="Courier New,Courier"><font color="#3333FF"> setenv
new $2</font></font></b>
<br><b><font face="Courier New,Courier"><font color="#3333FF"> setenv
old $1</font></font></b>
<br><b><font face="Courier New,Courier"><font color="#3333FF"> setenv
files $3</font></font></b>
<br><b><font face="Courier New,Courier"><font color="#3333FF"> </font></font></b>
<br><b><font face="Courier New,Courier"><font color="#3333FF"> echo
"replacing : $old --> $new in file $files "</font></font></b><b><font face="Courier New,Courier"><font color="#3333FF"></font></font></b>
<p><b><font face="Courier New,Courier"><font color="#3333FF"> perl
-p -i.bak -e 's/$ENV{"old"}/$ENV{"new"}/g' $files</font></font></b>
<br><b><font face="Courier New,Courier"><font color="#3333FF"></font></font></b>
<br><b><font face="Courier New,Courier"><font color="#3333FF"></font></font></b>
<br>
<br> </html>
--------------8711B6F0E72825F60F86274A--
------------------------------
Date: Wed, 01 Aug 2001 11:03:03 -0400
From: Edward Little Titan/SRC x4621 <strawSPAM_BEGONEman@plexi.com>
Subject: question on Here documents
Message-Id: <3B681A27.F1C61C07@plexi.com>
Is it possible to call a member function in a here document to provide a
value?
For instance, assume $object is a referance to an object:
...
my $text = << "END_HERE"
yadayadayada
yadayadayada
yadayadayada
The value is: $object->getValue()
yadayadayada
------------------------------
Date: 1 Aug 2001 06:40:43 -0700
From: tommyumuc@aol.com (JR)
Subject: Regex Question...
Message-Id: <319333f5.0108010540.42d9391d@posting.google.com>
I have a series of about 500 .dbf files that I need to merge
together into one large file that is sorted and neatly formatted.
For example, in the below partial file, I have:
$myVar=<<"FILE";
1 5C162810001H51Delaware Bay 188
2 92C162810001H51Delaware Bay 44 3 204
C162810001D85Killen Pond State Park 8 4 207
C162810001D85Killen Pond State Park 8
FILE
$myVar =~ s/\\W+//egs; #works
$myVar =~ s/\n//egs; #doesn't work
I've tried getting rid of instances of more than 2 spaces in the file,
which worked well, but I can't seem to get rid of the newline
characters in the same fashion. What I would like this file to
become ultimately (and I realize that after I have stripped the
newline characters, this is still a few lines of code away) is this
exactly:
1 5 C1628 10001 H51 Delaware Bay 188
2 92 C1628 10001 H51 Delaware Bay 44
3 204 C1628 10001 D85 Killen Pond State Park 8
4 207 C1628 10001 D84 Killen Pond State Park 8
After I have it in this format, I've already created the script to
merge the files (which I have tested, and works fine--I run this
script on the directory where I have the files I would like to merge
and then just redirect it into a .dat file--this script took only a
few minutes to write and once handled 16 million records in only 20
minutes):
#!/usr/bin/perl
opendir (DH, 'other_blocks') || die "Cannot open: $!";
while ($file=readdir DH) {
next if (-d "other_blocks/$file");
if (! open (F, "other_blocks/$file") ) {
warn "Cannot search: $!";
next;
}
while(<F>) {
$_ =~ s/ /0/g;
$st = substr($_, 1,2);
$cou = substr($_, 3, 3);
$cen = substr($_, 6, 6);
$block = substr($_, 12 ,4);
$land = substr($_, 91, 14);
$pop = substr($_, 117, 6);
if ($st == '02') {
print "$st$cou$census$block\t$land\t$pop\n";
}
elsif ($st == '15') {
print "$st$cou$census$block\t$land\t$pop\n";
}
elsif ($st == '72') {
print "$st$cou$census$block\t$land\t$pop\n";
}
else {
print "Incorrect values!\n";
}
}
}
I appreciate any suggestions anyone may have--thank you.
------------------------------
Date: Wed, 01 Aug 2001 14:46:31 GMT
From: Randall Woodman <rwoodman_nospam_@verio.net>
Subject: Re: Reporting Questionable Programming Activity
Message-Id: <3B681681.9C0A26C7@verio.net>
Smiley wrote:
> The company I'm working for purchased a Perl CGI Script that turns out
> to be seriously faulty - so much so that my boss asked me to
> investigate whether there's any international agency or organization
> set up that we can report this kind of thing to.
>
> Does anybody know? Thanks :)
Would you like to hire me to fix it for you.
HHJK
------------------------------
Date: 1 Aug 2001 06:34:00 -0700
From: samara_biz@hotmail.com (Alex)
Subject: Script works on PWS but not IIS?
Message-Id: <c7d9d63c.0108010534.50dae317@posting.google.com>
Hi,
I am trying to install Matt Wright's guestbook script on a website on
a IIS webserver. When I try to run it I get the following error
message:
----------
CGI Error
The specified CGI application misbehaved by not returning a complete
set of HTTP headers. The headers it did return are:
Can't Open e:/Inetpub/wwwroot/Edtech/iei/guestbook/guestbook.html:
Permission denied
----------
I only have ftp access to the IIS webserver. At first I thought that
the problem is in write permission on guestbook.html. I have a PWS
webserver installed on my local machine. When I install the script
there, it runs just fine! It doesn't even matter whether
guestbook.html has write permission enabled or not. I tried really
hard to model the same problem, but I couldn't.
I'm very confused... Why does the script run on PWS, but wouldn't run
on IIS?
Any help is very appreciated. I searched for the solution to this
problem for hours, but can't seem to come up with anything on my own,
that's why I'm posting this here.
Thanks again,
Alex
------------------------------
Date: Wed, 1 Aug 2001 17:34:07 +0800
From: "Frank" <frank@cs.nchu.edu.tw>
Subject: Re: sending email problems in CGI
Message-Id: <9k8kjf$eefkh$1@news.ht.net.tw>
I didn't use the Mail::Mailer Module,
I use Net::SMTP to send a mail
the code is list below:
----------------------------------------------------------------------------
-----------
use Net::SMTP;
mail_host = 'xxx.com';
$fromaddr = 'frank@xxx.com';
$toaddr = 'angel@xxx.com';
$smtp = Net::SMTP->new( $mail_host, Timeout => 20);
$Title = 'Subscribe Error Inform';
$smtp->mail($fromaddr);
$smtp->to($toaddr);
$smtp->data();
### Here is the Title
$smtp->datasend("Subject: $Title\n");
$smtp->datasend("\n");
### Here is the Context
$smtp->datasend("put Context here!\n");
$smtp->datasend("XXXX YYYY ZZZZ\n");
$smtp->dataend();
$smtp->quit;
----------------------------------------------------------------------------
-----------
------------------------------
Date: Wed, 01 Aug 2001 16:59:07 +0200
From: Hermann Fass <hermann@holzerath.de>
Subject: Re: Splitting Peculiar HTML
Message-Id: <3B68193B.2555438F@holzerath.de>
"Godzilla!" wrote:
>
> Bill Atkins wrote:
>
> > Four other people understodd it, didn't they?
>
> All four of those other people are you.
>
> OH NOOOOooooooo.... MR. BILL!
>
> Godzilla! Queen Of Understodd.
To understand what is HTML and what is not, read
http://www.ietf.org/rfc/rfc1866.txt
Cheers
Hermann
------------------------------
Date: Wed, 1 Aug 2001 13:45:01 +0200
From: <666.diablo@wanadoo.fr>
Subject: system function problems
Message-Id: <9k8q59$18c$1@wanadoo.fr>
I have a problem with system function
I'm writing a script to simplify AC3 TO MP3 comversion.
And I'm using Azid to extract wav from AC3 file, and x3enc to encode wav to
mp3.
When I call azid with system
system("$azid --gain=$gain \"$SonAc3_1\" \"$SonTmp_1\"")
it work but each time I go a return error (system return a value != than 0)
And after i call x3enc like this
$bps = sprintf "-b%s000",$soundbitrate;
@args = ("$x3enc", "$SonTmp_1 $SonMP3_1 $bps");
system(@args);
The compression start correctly, but.... I restart after. In fact, there are
2 compression, system function start twice x3enc!
I tried
$bps = sprintf "-b%s000",$soundbitrate;
$args ="$x3enc $SonTmp_1 $SonMP3_1 $bps";
system($args);
It's the same thing
If you know why it is doing this, please help me
OS: Windows 2000
perl version: perl, v5.6.0 built for MSWin32-x86-multi-thread
PS: please forward your message to 666.diablo@wanadoo.fr
------------------------------
Date: 1 Aug 2001 13:33:08 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Telnet/MUD server
Message-Id: <996672697.16633@itz.pp.sci.fi>
In article <NN8NJHAG+vZ7EwsW@zaynar.demon.co.uk>, Philip Taylor wrote:
>
>I don't need to use the 'real' TELNET protocol -- I just called it
>"Telnet" because all the programs which I've connected with are Telnet
>terminals (although I've now found that I can use IRC and MUD clients
>too)
Actually, the TELNET protocol has a bunch of features that can be quite
useful for a MUD, which is why many MUD servers and clients speak it.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Wed, 01 Aug 2001 12:18:36 GMT
From: "Blnukem" <blnukem@hotmail.com>
Subject: temp files
Message-Id: <wsS97.64053$UH6.10770410@news02.optonline.net>
Hi Group
Why do I get these temp files in my cgi-bin of "CGItemp-2204510002" when I
use "use CGI ':standard'" in my scripts.
Im using win 98se
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1421
***************************************