[10307] in Perl-Users-Digest
Perl-Users Digest, Issue: 3900 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 6 09:07:42 1998
Date: Tue, 6 Oct 98 06:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 6 Oct 1998 Volume: 8 Number: 3900
Today's topics:
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: Accessing Access97 using ADO DB... <stefan.haller@ascom.ch>
Are there any "perl.newbie" group or forum? <hauk@forumnett.no>
Re: Copying files <tonylabb@infonline.net>
Re: forms with perl <jbharvey@auspex.net>
Re: HELP with variable naming <Paul.Makepeace@POBox.com>
Re: How do I 'su' to in a perl script (when password is <jbharvey@auspex.net>
Re: How to pass a hash array to a sub program huntersean@hotmail.com
Re: Keeping a running list of the top n values retrieve <garethr@cre.canon.co.uk>
Re: Keeping a running list of the top n values retrieve (Sam Holden)
Re: Keeping a running list of the top n values retrieve <garethr@cre.canon.co.uk>
Re: newbie trying to parse one file into three <jbharvey@auspex.net>
Re: newbie trying to parse one file into three huntersean@hotmail.com
Perl and Access <s.p.telgenhof.oude.koehorst@stud.tue.nl>
Re: Perl and Novell Netware v4 (Jeffrey R. Drumm)
Re: Shuffling of array content <hauk@forumnett.no>
Re: Shuffling of array content (Sam Holden)
Re: Shuffling of array content <ckc@dmi.dk>
Re: Socet script problem. <erhmiru@erh.ericsson.se>
Re: Split question - retain the pattern? (Bart Lateur)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 06 Oct 1998 10:24:01 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage907669441.3709@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 06 Oct 1998 13:48:38 +0200
From: haller <stefan.haller@ascom.ch>
To: Paul Murray <murray-paul@usa.net>
Subject: Re: Accessing Access97 using ADO DB...
Message-Id: <361A0396.3DADF8FA@ascom.ch>
Hello
Thanks for this info, but it doesn't work, though.
would you please have a look at my code:
-------------------------
use OLE;
$cnDB = CreateObject OLE 'ADODB.Connection' or
&DisplayErrorMsg(5,"ADODB.Connection"); #die "CreateObject: $!";
$cnDB->Open('Test');
$sql = "SELECT * FROM TestTable;";
$rsData = $cnDB->Execute($sql);
while ( !$rsData->EOF ) {
print $rsData->Fields('Name')->Value;
$rsData->MoveNext;
}
$rsData->MoveLast;
print $rsData->RecordCount;
$rsData->Close();
$cnDB->Close();
--------------------------
I think, I'm quite close, but I can't find out what is wrong here.
the while-loop works fine, but the 'print $rsData->RecordCount;'
line still shows -1.
What is wrong here?
Thank you for all help.
regards
Stefan
Paul Murray wrote:
> On Mon, 05 Oct 1998 16:25:03 +0200, haller <haller@broadnet.ascom.ch> wrote:
> >2. I made a query and would like to see, if it found something.
> >So, I tried '$rs->RecordCount' but this returns always -1, but there
> >should be 4 records found.. If I use '$rs->MoveNext' and
> >'$rs->Fields->Value;' the right values are displayed.
> >what could I've done wrong.. or am I calling a wrong function?
>
> Assuming this is the same basic code as MFCs database access classes,
> then from their help:
>
> "[RecordCount] does not indicate how many records are contained in a
> dynaset-type or snapshot-type recordset until all records have been
> accessed. [...] To force the last record to be accessed, call the
> MoveLast [function]."
--
"Those are my principles! And if you don't like them... well, I have
others..."
-- Groucho Marx
------------------------------
Date: Tue, 06 Oct 1998 12:19:14 +0200
From: Hauk Langlo <hauk@forumnett.no>
Subject: Are there any "perl.newbie" group or forum?
Message-Id: <3619EEA2.87134CE2@forumnett.no>
I'm sure there are a lot of people reluctant to post questions here
afraid of having "RTFM" yelled in their face each time. I'm not an
expert myselfe and I would really like to know if there are any
discussion forums etc where it is actually legal to ask questions that
might be of a basic nature to some. If you know about something like
that, please let me know and me and probably a lot of other will go away
and leave you guys alone.
Hauk Langlo
--
----------------------------------
Hauk Langlo
Hauk@forumnett.no
http://www.forumnett.no/~hauk
(+047) 93438940
----------------------------------
------------------------------
Date: Tue, 06 Oct 1998 07:52:46 -0400
From: Tony Labbiento <tonylabb@infonline.net>
Subject: Re: Copying files
Message-Id: <361A048E.49F18A28@infonline.net>
You need to use "binmode FILEHANDLE" immediately after the open
statement in order to use a binary file.
Nico wrote:
>
> I'm trying to copy a JPG file (Per5.004 win 95)
>
> The following code opens the file, but does not copy all the contents.
> The source file etc does exist.
>
> Please help
>
> #copy JPG
>
> #Read file
> open (JPGFILE,$jpgfilesource) || die "x4 can not open $jpgfilesource";
> open (JPGFILE2,">$jpgfile") || die "x5 can not open $jpgfile";
> while (<JPGFILE>)
> {print JPGFILE2;}
> close (JPGFILE);
> close (JPGFILE2);
>
> Thanks
>
> Nico
--
****************************************
* Tony Labbiento *
* Infinity Online, Inc. *
****************************************
------------------------------
Date: Tue, 06 Oct 1998 12:38:26 GMT
From: Justin Harvey <jbharvey@auspex.net>
Subject: Re: forms with perl
Message-Id: <361A0F34.3AF39512@auspex.net>
Check out CGI.pm in:
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
Steve Goodyear wrote:
>
> Essentially I need to replace a standard HTML form using the POST method
> with a perl script...
>
> I'm not real sure where to start....
--
Justin B. Harvey http://www.auspex.net/jbharvey
jbharvey@auspex.net Mountain View, CA
use Perl || die "trying";
------------------------------
Date: Tue, 6 Oct 1998 11:52:37 +0100
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Re: HELP with variable naming
Message-Id: <6vd2r1$c1j$1@statler.server.colt.net>
[posted & mailed to author]
From: Andrew Perrella <ap85@cornell.edu>
>Hello,
>
> I have an array (called name_array) with 9 keys and values. All of
>the keys are of the form 1_1_i where i is a number from 0-8.
For what it's worth...
Don't forget that 1_1_1 is a valid Perl number (one hundred and eleven) so
you could actually use an array there rather than a hash. Or make use of the
fact it's a number in some way (110+$i). Don't forget to comment what you're
doing ;-)
You don't give any indication of how this problem might scale but bear in
mind you might end up wasting a lot of space though as all array elements go
from 0 (or deprecated $[) on.
Other people have answered the rest of this (use $a[0]..., avoid symbolic
refs, etc).
--
Paul Makepeace, Independent Thinkers Ltd (UK)
0171 377 8668 / 0973 800436
"People are all monkeys, and I am Captain Banana"
-- Vincent Gallo
------------------------------
Date: Tue, 06 Oct 1998 12:30:00 GMT
From: Justin Harvey <jbharvey@auspex.net>
Subject: Re: How do I 'su' to in a perl script (when password is known)
Message-Id: <361A0D3A.58CD3305@auspex.net>
Neat sig
Russ Allbery wrote:
>
> Gerard Hammond <g.hammond@garvan.unsw.edu.au> writes:
>
> > I am stuck at the point when I need the perl script to setuid to the
> > person who entered the data from the web page. The person will have
> > entered their user name and passwd from the web page. Yes I understand
> > there are a lot of security issues with this whole idea!)
>
> > So how do I set the perl script to write files in their directory. Is
> > there some call that temporarily runs the script as the web user.
>
> See man perlvar under $> and $<. Basically, all you have to do is figure
> out what UID you want to switch to and then set $> to it:
>
> $> = $uid;
>
> Note that you have never completely successfully dropped permissions under
> Unix (at least so far as my understanding of it goes) until you've set the
> real and effective UIDs ($< and $>) to the new UID and then exec'd
> something. Until then, it's always possible for code to regain your
> original UID.
>
> --
> #!/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
--
Justin B. Harvey http://www.auspex.net/jbharvey
jbharvey@auspex.net Mountain View, CA
use Perl || die "trying";
------------------------------
Date: Tue, 06 Oct 1998 12:14:15 GMT
From: huntersean@hotmail.com
Subject: Re: How to pass a hash array to a sub program
Message-Id: <6vd1in$bvb$1@nnrp1.dejanews.com>
You need to pass it as a hash reference. Check out perldoc perlref.
Something like:
my %hash_array = (
"one" => "1",
"two" => "2",
"three" => "3"
);
print "Here is the hash array in the main program:\n";
while (my ($key,$value) = each %hash_array) {print "$key=$value\n";}
print_hash(\%hash_array);
sub print_hash
{
print "Here is the hash array passed into the subprogram:\n";
while (my ($key,$value) = each %{$_}) {print "$key=$value\n";}
}
Sean Hunter
In article <36193FFC.BF5C898D@home.com>,
Douglas Galbraith <douglas@home.com> wrote:
> Hello, and thanks for the help;
>
> How do you pass a hash array to a subprogram? Below is an example that
> I
> can't get to work.
>
> thanks,
> DGalbra862@aol.com
>
> -------------------------------------------------------------
>
> my %hash_array = (
> "one" => "1",
> "two" => "2",
> "three" => "3"
> );
>
> print "Here is the hash array in the main program:\n";
> while (my ($key,$value) = each %hash_array) {print "$key=$value\n";}
> print_hash(%hash_array);
>
> sub print_hash
> {
> print "Here is the hash array passed into the subprogram:\n";
> while (my ($key,$value) = each %_) {print "$key=$value\n";}
> }
>
> -------------------------------------------------------------
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 6 Oct 1998 10:04:38 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Keeping a running list of the top n values retrieved
Message-Id: <sivhly3t1l.fsf@cre.canon.co.uk>
Nick Tonkin wrote:
> Is there a standard way to keep a running list of the top 20 scoring
> variables?
Gareth Rees wrote:
> Yes. It's a data structure called a "heap".
Sam Holden wrote:
> How does a heap help... good for priority queues I admit... but for
> keeping track of the top n values surely a bit excessive... especially
> since perl does arrays for you...and sorting for that matter...
Heaps are well-suited for some applications, not suited for others. The
fact that Perl has a useful set of built-in data structures is no excuse
of being ignorant of others.
A heap might be an excessive solution for keeping the top n values; it
depends what n is, and what the values are used for, and how often a new
value arrives, and how often the top n are looked at, and how important
it is for the code to run quickly versus how important it is for the
code to be small and quickly written.
It's up to the programmer to make these decisions, but they can't be
shouldn't be made in ignorance. If you choose
> @top_20 = (sort {$b <=> $a} @top_20,$new_value)[0..19];
as your solution, then it should be because it's the best solution for
the problem at hand, not merely because it's the only one you know how
to write.
(In any case, surely it's better to truncate @top_20 using $#top_20=19?)
--
Gareth Rees
------------------------------
Date: 6 Oct 1998 10:34:06 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Keeping a running list of the top n values retrieved
Message-Id: <slrn71jsgt.amu.sholden@pgrad.cs.usyd.edu.au>
On Tue, 6 Oct 1998 10:04:38 GMT, Gareth Rees <garethr@cre.canon.co.uk> wrote:
>Nick Tonkin wrote:
>> Is there a standard way to keep a running list of the top 20 scoring
>> variables?
>
>Gareth Rees wrote:
>> Yes. It's a data structure called a "heap".
>
>Sam Holden wrote:
>> How does a heap help... good for priority queues I admit... but for
>> keeping track of the top n values surely a bit excessive... especially
>> since perl does arrays for you...and sorting for that matter...
>
>Heaps are well-suited for some applications, not suited for others. The
>fact that Perl has a useful set of built-in data structures is no excuse
>of being ignorant of others.
True enough, but using perl's data structures keeps you inside perl's
C implementation and out of the shall we say slow dispatcher...
>
>A heap might be an excessive solution for keeping the top n values; it
>depends what n is, and what the values are used for, and how often a new
>value arrives, and how often the top n are looked at, and how important
>it is for the code to run quickly versus how important it is for the
>code to be small and quickly written.
>
>It's up to the programmer to make these decisions, but they can't be
>shouldn't be made in ignorance. If you choose
>
>> @top_20 = (sort {$b <=> $a} @top_20,$new_value)[0..19];
>
>as your solution, then it should be because it's the best solution for
>the problem at hand, not merely because it's the only one you know how
>to write.
>
>(In any case, surely it's better to truncate @top_20 using $#top_20=19?)
Very probably I just didn't think of it at the time and as I said I would work
on optimising for speed and space after I got the answer right... Obviously
inserting the element at the correct place is the way to go (or maybe being lazy
and sorting and discarding at the last minute).
How does a heap help in any great way to solving a 'top n' problem anyway? I'm
not trying to say it doesn't. I'm honestly interested in how you would use it.
It's been a long time since I used a heap and I can't see how it could be done
other than deleting the minimum everytime it gets too full...
But that would only give you O(lg n) worst case complexity, which I could get
with much less effort by using binary insertion.
A fibonacci heap might win in worst case but I'll leave writting one of them
that actually runs at a reasonable speed to someone else...
--
Sam
Even if you aren't in doubt, consider the mental welfare of the person
who has to maintain the code after you, and who will probably put parens
in the wrong place. --Larry Wall
------------------------------
Date: Tue, 6 Oct 1998 10:50:00 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Keeping a running list of the top n values retrieved
Message-Id: <sipvc63qxz.fsf@cre.canon.co.uk>
Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
> How does a heap help in any great way to solving a 'top n' problem
> anyway? I'm not trying to say it doesn't. I'm honestly interested in
> how you would use it. It's been a long time since I used a heap and I
> can't see how it could be done other than deleting the minimum
> everytime it gets too full...
That's right.
initialise the heap with n values of -infinity
keep the heap sorted in reverse, with the minimum at the top
if a new item is less than the minimum, it doesn't get into the top n
if a new item is greater than the minimum, swap the two (and throw away
the latter) then heapify
O(log n) to add a new item.
> But that would only give you O(lg n) worst case complexity, which I
> could get with much less effort by using binary insertion.
Sure, you can find the insertion point in O(log n) but how do you do the
insertion?
(There's a trade off between keeping the top n in sorted order and
making it easy to add new items - which is best depends on how often new
items are added and how often you need to look at the sorted list.)
--
Gareth Rees
------------------------------
Date: Tue, 06 Oct 1998 12:28:27 GMT
From: Justin Harvey <jbharvey@auspex.net>
Subject: Re: newbie trying to parse one file into three
Message-Id: <361A0CDD.F53A9F49@auspex.net>
# Let's say you have a text file called data and it's filled with
# stuff like:
# one, two, three, four, five, six, seven
Here is a sample script, your mileage may vary
open FH1, ">file.one" or die "Cannot open file.one\n";
open FH2, ">file.two" or die "Cannot open file.two\n";
open FH3, ">file.three" or die "Cannot open file.three\n";
while(<>) {
chomp;
($one, $two, $three, $four, $five, $six, $seven) = split /,/;
print FH1 "$one, $four, $seven\n";
print FH2 "$two, $five\n";
print FH3 "$three, $six\n";
}
close FH1;
close FH2;
close FH3;
Larry Quantz wrote:
>
> I've got a text file with various records in it. Each record is on an
> individual line, and each record is comma delimited.
>
> I need to take this file, and put (let's say) fields one, four and seven
> of each record into a file. Likewise, I need to put fields two and five
> into another file, while fields three and six go into a third file.
>
> I've got a rough idea on what to do, but what Perl statements/code will
> best allow me to do so? I'd like to have a solid footing to go on before I
> start. Thanks for any and all help.
--
Justin B. Harvey http://www.auspex.net/jbharvey
jbharvey@auspex.net Mountain View, CA
use Perl || die "trying";
------------------------------
Date: Tue, 06 Oct 1998 12:32:05 GMT
From: huntersean@hotmail.com
Subject: Re: newbie trying to parse one file into three
Message-Id: <6vd2k5$dqp$1@nnrp1.dejanews.com>
You need split. Essentially something like:
open INPUT_FILE, "< my_input_filename";
open FILE1, "> file1";
open FILE2, "> file2";
open FILE3, "> file3";
while(<INPUT_FILE>) {
my @fields = split /,/;
print FILE1, @fields[0, 3, 6];
print FILE2, @fields[1, 4];
print FILE1, @fields[2, 5];
}
...modulo error handling etc...
Sean Hunter
In article <6vc6h4$f90$1@news.idiom.com>,
"Larry Quantz" <quartz@nospam.idiom.com> wrote:
>
>
> I've got a text file with various records in it. Each record is on an
> individual line, and each record is comma delimited.
>
> I need to take this file, and put (let's say) fields one, four and seven
> of each record into a file. Likewise, I need to put fields two and five
> into another file, while fields three and six go into a third file.
>
> I've got a rough idea on what to do, but what Perl statements/code will
> best allow me to do so? I'd like to have a solid footing to go on before I
> start. Thanks for any and all help.
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 6 Oct 1998 13:03:17 +0200
From: "ST" <s.p.telgenhof.oude.koehorst@stud.tue.nl>
Subject: Perl and Access
Message-Id: <6vctsm$7s9@tuegate.tue.nl>
Hello,
The use of Win32::ODBC makes it possible to connect to Access-databases.
But can this also be used on a server running Apache [Unix] or is there
another way to do this?
Sincerely,
S.P. Telgenhof Oude Koehorst
------------------------------
Date: Tue, 06 Oct 1998 11:04:14 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Perl and Novell Netware v4
Message-Id: <361af5f3.316329397@news.mmc.org>
[ posted to comp.lang.perl.misc and a courtesy copy was mailed to the cited
author ]
On Mon, 05 Oct 1998 18:04:09 GMT, mscongdon@hotmail.com (Michael Congdon)
wrote:
>Our company is using a Novell Netware 4.0 server and I'm trying to use
>publish our web site using a Perl database script. I'm wondering what
>the default ROOT directory is in NetWare.
>
>Also, when do you use "sys:" in the PATH.
Michael,
The other posts you've received in response to your query probably weren't
quite as helpful as you'd like. You may suspect the helpfulness of this one
too, but trust me, it's the best advice you'll get.
RUN, DO NOT walk, away from this project while you still have your sanity. The
Perl implementation that comes stock with Netware 4.x is horribly broken in
more ways than you can imagine, and the Netware Web server software is just as
bad.
I STRONGLY urge you to consider obtaining one of the free Unices (or, *shudder*
even NT) and use it to host your web site.
Don't host your site on a Netware[1] server, especially if you need dynamic
content. Down that path lies madness.
[1] That said, there appears to be some hope for Intranetware 5. A much
stronger perl is apparently available for it, but I have no direct experience
with it.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Tue, 06 Oct 1998 12:09:39 +0200
From: Hauk Langlo <hauk@forumnett.no>
To: Sam Holden <sholden@pgrad.cs.usyd.edu.au>
Subject: Re: Shuffling of array content
Message-Id: <3619EC63.6598424C@forumnett.no>
> >
> >PS: No flaming please. I'm a newbie allright, but I have learned (the
> >hard way) not to post lazyquestions etc. Hope you do not find this
> >question infuriating.
>
> Well don't post lazyquestions then...
>
> perldoc perlfaq4 => 'How do I shuffle an array randomly'
>
> Read the description for why your suggested solution is shall we say _really_
> bad...
Had a wee look at the splice command (about time I guess). Anyway, using splice
it's really childs play. Those examples you mentioned was exactly what I wanted
to do. But then I was not aware of the splice. (I know RTFM).
PS: There are a reason why medical surgeons are educated. It is ofcourse possible
to learn everything by yourselfe. But what is the point of this newsgroup if you
are welcomed to participate only if you allready know everything? The point is
how I see it that people with less knowledge/experience in a field is
communicating with others with a more solid knowledge about those issues. What
would happen if no questions where asked in this forum? Well, then the experts
could start discussing TV shows etc with eachoter. All questions are asked by
someone with less knowledge than the person who eventually post an answer. If
that is not acceptable, than this group does'nt have any resons to exist the way
I see it.
> There that wasn't a flame... though I'm sure someone else will get you...
Did'nt consider it a flame either. Note that the PS: stuff is not personally
aimed towards you. Other's will probably get me allright, but withouth my
concern. I know to myselfe that I posted a question wich was to me sensible. The
reason I posted it was because I realized that my soulution was as you said
_really_ bad. Otherwize I would not post it.
> Oh yeah what this really means is RTFM...
Oh well, maybe I should rather become a surgeon. Then I could always ask someone
if needed.
--
----------------------------------
Hauk Langlo
Hauk@forumnett.no
http://www.forumnett.no/~hauk
(+047) 93438940
----------------------------------
------------------------------
Date: 6 Oct 1998 10:17:55 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Shuffling of array content
Message-Id: <slrn71jrij.amu.sholden@pgrad.cs.usyd.edu.au>
On Tue, 06 Oct 1998 12:09:39 +0200, Hauk Langlo <hauk@forumnett.no> wrote:
>> >
>> >PS: No flaming please. I'm a newbie allright, but I have learned (the
>> >hard way) not to post lazyquestions etc. Hope you do not find this
>> >question infuriating.
>>
>> Well don't post lazyquestions then...
>>
>> perldoc perlfaq4 => 'How do I shuffle an array randomly'
>>
>> Read the description for why your suggested solution is shall we say _really_
>> bad...
>
>Had a wee look at the splice command (about time I guess). Anyway, using splice
>it's really childs play. Those examples you mentioned was exactly what I wanted
>to do. But then I was not aware of the splice. (I know RTFM).
>
>PS: There are a reason why medical surgeons are educated. It is ofcourse possible
>to learn everything by yourselfe. But what is the point of this newsgroup if you
>are welcomed to participate only if you allready know everything? The point is
>how I see it that people with less knowledge/experience in a field is
>communicating with others with a more solid knowledge about those issues. What
>would happen if no questions where asked in this forum? Well, then the experts
>could start discussing TV shows etc with eachoter. All questions are asked by
>someone with less knowledge than the person who eventually post an answer. If
>that is not acceptable, than this group does'nt have any resons to exist the way
>I see it.
Well then you are sadly mistaken this newsgroup does not exist to answer your
FAQs, it exists to answer questions for which there isn't documentation sitting
in front of that specifically answers that very question.
Ask a question that isn't a FAQ, and show you will have better milage. Medical
surgeons recieve a lot of their education from things called books... your
perl documentation is like that... Learn from it it was written by people
who are smarter than you (and me)...
I suggest you get a slightly firmer grip on reality and learn a bit about
usenet before you start exaplaining how it should work...
>
>> There that wasn't a flame... though I'm sure someone else will get you...
>
>Did'nt consider it a flame either. Note that the PS: stuff is not personally
>aimed towards you. Other's will probably get me allright, but withouth my
>concern. I know to myselfe that I posted a question wich was to me sensible. The
>reason I posted it was because I realized that my soulution was as you said
>_really_ bad. Otherwize I would not post it.
>
>> Oh yeah what this really means is RTFM...
>
>Oh well, maybe I should rather become a surgeon. Then I could always ask someone
>if needed.
I promise you if you kept asking questions like :
'Where are the lungs again?',
'How do I use this knife thingy...?'
'How do I stitch up a wound?'
then very quickly you would be told to RTFM in no uncertain terms...
Your question was answered exactly in the FAQ - etiquitte says to read the
FAQ before you post to a newsgroup... Posting questions that aren't FAQs is
perfectly acceptable and will result in interesting replies as long as you
show you have put in a bit of effort...
Try asking some surgeons to solve all your problems without showing one
bit of evidence that you have at least looked up the standard textbook on the
topic area... - which is the equivalent to what you asked...
Congratulations on getting yourself plonked though...
--
Sam
There's no such thing as a simple cache bug.
--Rob Pike
------------------------------
Date: Tue, 6 Oct 1998 12:13:08 +0100
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: Shuffling of array content
Message-Id: <Pine.GSO.3.92.981006120747.19750P-100000@edb>
On Tue, 6 Oct 1998, Hauk Langlo wrote:
> PS: There are a reason why medical surgeons are educated. It is ofcourse possible
> to learn everything by yourselfe. But what is the point of this newsgroup if you
> are welcomed to participate only if you allready know everything? The point is
> how I see it that people with less knowledge/experience in a field is
> communicating with others with a more solid knowledge about those issues.
That is not at all what's going on in c.l.p.m. What people are saying here
is, read the docs before you ask a question. Check DejaNews before you ask
a question.
Perl is so widely used that answering the same questions over and over can
amount to several hundreds of posts in a few days. That makes c.l.p.m.
really hard to use. Now, if answers to all the questions which are covered
by documentation (documentation, I might add, which 99% of those asking
_already have_!) were actually sought IN the documentation, clpm would be
a much less trafficked newsgroup, and much more useful for everyone.
It's not a question of not wanting to answer questions. Although I'm not a
surgeon, I'm betting that if a medical student were to ask his professor
how the heart works, he would be gently pointed towards his basic anatomy
books. Same thing here.
Kvan.
-------Casper Kvan Clausen------ | 'Screw you guys, I'm going home!
----------<ckc@dmi.dk>---------- | Talking poo is where I draw the
Lokal 544 | line!'
I do not speak for DMI, just me. | - Eric Cartman.
------------------------------
Date: 06 Oct 1998 12:10:06 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Re: Socet script problem.
Message-Id: <lapvc6rog1.fsf@erh.ericsson.se>
Hello,
nobody seems to know the answer to my problem, but I solved it myslef.
Well, the problem was in the perl version. The Socket library refuseed
to work correctly with ActiveWare build 316 (it was 5.003_07).
I upgraded to 5.005_02 and all problems are gone.
Somebody might be interested...
Michal
Michal Rutka <erhmiru@erh.ericsson.se> writes:
> Hello,
>
> I have the following script:
>
[...] the sample socket script deleted.
> which prints date/time from the remote host. It works fine both under
> UNIX and Windows. However only when Windows machine is on the LAN. When
> I run this script at home (where I have Windows and dialup networking), it
> dies on socket. What is annoying that it does not give any error message.
> $! is empty. Does anybody know where a problem might be? All other programs
> which I am using at home with Winsock are working fine.
------------------------------
Date: Tue, 06 Oct 1998 13:24:53 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Split question - retain the pattern?
Message-Id: <361d1978.22017784@news.ping.be>
A.J. Norman wrote:
>(I had already looked at
> split's ability to return the patterns as alternate elements in the
> array, but wanted to avoid having to glue all the full stops back to
> the original sentences).
In that case, you might drop the split altogether, and check out the
/(pattern)/g possibility that returns a list of all matches.
Something like this might work (untested); if it doesn't, it should at
least serve as an inspiration.
@sentences = /(.*?[?.])\s+/g;
Bart.
------------------------------
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 3900
**************************************