[24272] in Perl-Users-Digest
Perl-Users Digest, Issue: 6463 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 25 21:05:38 2004
Date: Sun, 25 Apr 2004 18:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 25 Apr 2004 Volume: 10 Number: 6463
Today's topics:
Re: Array index bug using concatenated numbers <krahnj@acm.org>
blogger problem, printing too much <robin @ infusedlight.net>
Re: blogger problem, printing too much <noreply@gunnar.cc>
is there a way ..... any way <andries@zilz.nl>
Re: is there a way ..... any way <noreply@gunnar.cc>
Re: is there a way ..... any way <catcher@linuxmail.org>
Re: is there a way ..... any way <noreply@gunnar.cc>
Re: is there a way ..... any way <andries@zilz.nl>
Re: is there a way ..... any way (Walter Roberson)
Re: Pipe outputs response to browser (Sam Holden)
Re: slurp not working? ideas please! <robin @ infusedlight.net>
Re: sort numeric lists <robin @ infusedlight.net>
Tripod wont find my lib files (javatiger)
Re: Tripod wont find my lib files <invalid-email@rochester.rr.com>
Re: variable interpolation failed :-( <robin @ infusedlight.net>
Re: variable interpolation failed :-( <robin @ infusedlight.net>
Re: variable interpolation failed :-( <robin @ infusedlight.net>
Re: variable interpolation failed :-( <jurgenex@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 25 Apr 2004 23:21:31 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Array index bug using concatenated numbers
Message-Id: <408C47A8.4DC726D5@acm.org>
Joe Smith wrote:
>
> John W. Krahn wrote:
>
> > for my $x ( 0 .. X ) {
> > for my $y ( 0 .. Y ) {
> > my $i = 0 + ( $x . $y );
>
> Let's see; if $x = 1 and $y = 23, then $i = "123".
> But then if $x = 12 and $y = 3, then $i = "123".
> Therefore $array[$i] is going to get clobbered because you told it to.
>
> As you noticed, changing the calculation of $i so that it does not
> produce any duplicates makes the "problem" go away.
>
> As does using proper indexing: $array[$x][$y] = "something";
>
> I see no bug here.
Thanks Joe, I really need to get more sleep, it should have been
obvious! :-)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 25 Apr 2004 16:14:08 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: blogger problem, printing too much
Message-Id: <c6hhuk$haq$2@reader2.nmix.net>
Ok, here's the thing, when it prints the comments for the blog, it prints
each one twice, it's under sub view after if (url_param ('action2') eq
"showcomment")... I was thinking it was a problem with my getcomments sub,
but that returns the right ammount of comments... the posts in the blog are
put into blog.txt as the same format as the comments except the first string
before $splitstring is a incrementing number, starting at zero, and going
up, the counter is contained in count or counter (I forget) .txt. I dunno
what other information to give.
Why is it printing the comments twice, underneath the posts?
If you need more of this code, let me know.
Thanks.
--
Regards,
-Robin
--
[ webmaster @ infusedlight.net ]
www.infusedlight.net
sub view
{
my ($output, $modcommentpost) = @_;
if ($action eq "comment")
{
if (param ('commenttext') and param ('commenttext') !~ /<.*>/ and param
('commenttext') !~ /^\s*$/ and param ('commenttext') !~ /$splitstring/ and
param ('commenttext') ne "Post" and param ('commenttext') ne "Comment")
{
open (BLOG, ">>$blogfile") or print header and print "An error
occured during this operation: <b>$!</b>. Please press the back button on
your browser and try again.<hr>" and exit;
flock (BLOG, LOCK_EX);
print BLOG (url_param('count'), $splitstring, "Comment",
$splitstring, "<strong>Comment:</strong><br>", param ('commenttext'));
print BLOG ("\n");
close (BLOG);
print redirect
("$rootfile?action=view&action2=showcomment&output=Your+comment+has+been+pos
ted+and+is+being+viewed&count=" . url_param ('count'));
exit;
}
else
{
print redirect
("$rootfile?action=view&output=You+did+not+supply+the+post+or+you+used+HTML+
tags+which+are+not+allowed+on+this+system.");
exit;
}
}
if (url_param ('action2') eq "hidecomment")
{
print redirect
("$rootfile?action=view&output=Comment+has+been+hidden");
exit;
}
my @posts;
@posts = getposts();
my $posttotal;
$posttotal = getposttot();
print header;
print @head;
print <<END;
<div align="center">
<p>Blogger $version - $output </p>
<hr>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr> <td width="60%" align="left" valign="top"
bgcolor="#FFFF00"><p><strong>Total posts - $posttotal</strong></p>
END
my $post;
my @postsplit;
my @comments;
my @commentsplit;
my $comment;
if (@posts)
{
if (url_param ('action2') eq "showcomment")
{
my $post1;
@comments = getcomments (url_param ('count'));
foreach $post1 (@posts)
{
@postsplit = split (/$splitstring/, $post1);
print $postsplit[2], "<br>", "[ <a
href=\"$rootfile?action=view&action2=showcomment&count=$postsplit[0]\">Show
comments</a> ] [ <a href=\"$rootfile?action=view&action2=hidecomment\">Hide
comments</a> ] [ <a
href=\"$rootfile?action=newcomment&count=$postsplit[0]\">New comment</a> ]
[ <a href=\"$rootfile?action=printnewpost\">New post</a> ]<br><br>" if
($postsplit[1] eq "Post");
foreach $comment (reverse @comments)
{
@commentsplit = split (/$splitstring/, $comment);
print "<blockquote>", $commentsplit[2], "</blockquote>"
if ($postsplit[0] eq $commentsplit[0]);
}
}
}
else
{
foreach $post (reverse @posts)
{
@postsplit = split (/$splitstring/, $post);
print $postsplit[2], "<br>", "[ <a
href=\"$rootfile?action=view&action2=showcomment&count=$postsplit[0]\">Show
comments</a> ] [ <a href=\"$rootfile?action=view&action2=hidecomment\">Hide
comments</a> ] [ <a
href=\"$rootfile?action=newcomment&count=$postsplit[0]\">New comment</a> ]
[ <a href=\"$rootfile?action=printnewpost\">New post</a> ]<br><br>" if
($postsplit[1] eq "Post");
}
}
}
else
{
print "No posts";
}
print <<END;
<td width="40%" align="left" valign="top">$modcommentpost</td>
</tr>
</table>
<hr><center>[ <a href="$rootfile?action=printnewpost">New
post</a> ]</center>
</div>
END
print @foot;
exit;
}
sub getposts
{
my @poststoreturn;
if (-e $blogfile)
{
open (BLOG, $blogfile) or print header and print "An error occured
during this operation: <b>$!</b>. Please press the back button on your
browser and try again.<hr>" and exit;
flock (BLOG, LOCK_SH);
while (<BLOG>)
{
push (@poststoreturn, $_);
}
close (BLOG);
chomp (@poststoreturn);
return @poststoreturn;
}
else
{
return undef;
}
}
sub getcomments
{
my ($commentcount1) = @_;
my (@comments2, $comm, @commsplit, @commtoret);
@comments2 = getposts ();
foreach $comm (@comments2)
{
@commsplit = split (/$splitstring/, $comm);
if ($commsplit[0] eq $commentcount1 and $commsplit[1] eq "Comment")
{
push (@commtoret, $comm);
}
}
return (@commtoret);
}
--
Regards,
-Robin
--
[ webmaster @ infusedlight.net ]
www.infusedlight.net
------------------------------
Date: Mon, 26 Apr 2004 01:49:22 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: blogger problem, printing too much
Message-Id: <c6hiv6$c3f27$1@ID-184292.news.uni-berlin.de>
Robin wrote:
> Ok, here's the thing, when it prints the comments for the blog, it
> prints each one twice,
Then debug the program and correct the bug.
> If you need more of this code, let me know.
No. Absolutely not.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 26 Apr 2004 01:04:59 +0200
From: Andries <andries@zilz.nl>
Subject: is there a way ..... any way
Message-Id: <4hgo801hm3nrsce0ttakksqd3s4lnnn6hb@4ax.com>
Hello folks,
I tried lurking on but it stays jibberish to me.
Questions asked are responded with a jargon that is beyond my
comprehension and often in a tone you'll think twice to ask the next
question. So this is too heavy for me (yet?).
Is there a way that simple mortals can ask questions how to do things
with perl/ work with perl. Is there a newsgroup?
ok ok RTFM you'll say.
Obviously you don't understand my question and despair.
Andries Meijer
------------------------------
Date: Mon, 26 Apr 2004 01:36:25 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: is there a way ..... any way
Message-Id: <c6hi6t$cci8s$1@ID-184292.news.uni-berlin.de>
Andries wrote:
> I tried lurking on but it stays jibberish to me. Questions asked
> are responded with a jargon that is beyond my comprehension and
> often in a tone you'll think twice to ask the next question. So
> this is too heavy for me (yet?).
Actually, if you are referring to the "Novice..." thread you started,
you got plenty of useful advice. It's correct that nobody posted a
complete program, which is quite in order.
Please understand that this is not a help desk, it's not "write my
program for me for free" service!! (You also wrote me privately, and -
stupid as I may be - I sent you a complete program. Not sure if it
does exactly what you want, but it's a start.)
> Is there a way that simple mortals can ask questions how to do
> things with perl/ work with perl.
Absolutely. Provided, though, that those "mortals" *show* (not just
say) that they are interested in improving their Perl skill *and* that
they have made reasonable own efforts before posting.
> ok ok RTFM you'll say.
Yes. It can't be said too often. :)
> Obviously you don't understand my question and despair.
If you know no Perl, and are in such a hurry, the natural thing to do
is to *hire* somebody who helps you.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 25 Apr 2004 19:47:54 -0400
From: Robert <catcher@linuxmail.org>
Subject: Re: is there a way ..... any way
Message-Id: <daSdnftSOom30xHdRVn-gw@adelphia.com>
Andries wrote:
> Hello folks,
>
> I tried lurking on but it stays jibberish to me.
> Questions asked are responded with a jargon that is beyond my
> comprehension and often in a tone you'll think twice to ask the next
> question. So this is too heavy for me (yet?).
> Is there a way that simple mortals can ask questions how to do things
> with perl/ work with perl. Is there a newsgroup?
> ok ok RTFM you'll say.
> Obviously you don't understand my question and despair.
>
> Andries Meijer
There is a Perl beginnings list. That would probably be good for you.
http://learn.perl.org/
------------------------------
Date: Mon, 26 Apr 2004 01:55:35 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: is there a way ..... any way
Message-Id: <c6hjas$c832u$1@ID-184292.news.uni-berlin.de>
Robert wrote:
> Andries wrote:
>> Is there a way that simple mortals can ask questions how to do
>> things with perl/ work with perl. Is there a newsgroup?
>
> There is a Perl beginnings list. That would probably be good for
> you.
>
> http://learn.perl.org/
Even if I have never tried that list, I take for granted that you
cannot expect anybody to write your programs for you there either.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 26 Apr 2004 02:11:20 +0200
From: Andries <andries@zilz.nl>
Subject: Re: is there a way ..... any way
Message-Id: <9eko80tvb2m053u98cs78v5112gcbmnsh1@4ax.com>
On Mon, 26 Apr 2004 01:36:25 +0200, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>Andries wrote:
>> I tried lurking on but it stays jibberish to me. Questions asked
>> are responded with a jargon that is beyond my comprehension and
>> often in a tone you'll think twice to ask the next question. So
>> this is too heavy for me (yet?).
>
>Actually, if you are referring to the "Novice..." thread you started,
>you got plenty of useful advice. It's correct that nobody posted a
>complete program, which is quite in order.
>
>Please understand that this is not a help desk, it's not "write my
>program for me for free" service!! (You also wrote me privately, and -
>stupid as I may be - I sent you a complete program. Not sure if it
>does exactly what you want, but it's a start.)
>
>> Is there a way that simple mortals can ask questions how to do
>> things with perl/ work with perl.
>
>Absolutely. Provided, though, that those "mortals" *show* (not just
>say) that they are interested in improving their Perl skill *and* that
>they have made reasonable own efforts before posting.
>
>> ok ok RTFM you'll say.
>
>Yes. It can't be said too often. :)
>
>> Obviously you don't understand my question and despair.
>
>If you know no Perl, and are in such a hurry, the natural thing to do
>is to *hire* somebody who helps you.
Gunnar,
point taken. I just wanted a start that's all.
If you are new to something, like i am then it is helpfull to have a
start.
You helped me very much but the program you gave me is not the end. It
is a start for me. I can understand what it "does" and helps me to
improve my skills.
I can now look in the faqs and docs and look to my specific needs.
People like me learn from doing and trying and stumbling.
I think, although i can understand your point, that you have a rather
pessimistic view.
When i wanted just a program i would pay (of course). i wanted a
program to learn.
So you helped me to learn. And that's all that i wanted. It was never
my intention to take advantage of anyone.
Andries
------------------------------
Date: 26 Apr 2004 00:35:05 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: is there a way ..... any way
Message-Id: <c6hlfp$612$1@canopus.cc.umanitoba.ca>
In article <4hgo801hm3nrsce0ttakksqd3s4lnnn6hb@4ax.com>,
Andries <andries@zilz.nl> wrote:
:I tried lurking on but it stays jibberish to me.
:Questions asked are responded with a jargon that is beyond my
:comprehension and often in a tone you'll think twice to ask the next
:question. So this is too heavy for me (yet?).
There is certainly some truth in what you say, Andries. In my
experience, some of the people who post here (even some of the regulars)
often seem very harsh unless you ask your questions exactly the "right"
way. The "experience" of clpm is a lot different than in most of
the other technical newsgroups that I frequent, but I understand that
there are some newsgroups that are *much* worse.
As I understand, one part of the reason that people can seem so harsh
is that clpm is not really considered to be a newsgroup about how to
program in perl, or about how to install perl, and especially not a
newsgroup about how to program in general (happening to use perl as the
language): clpm is, I understand, considered to be a newsgroup about
the perl language itself. For example, one can ask about a particular
obscure feature of perl, or talk about the future of perl, but to be
"in", you are expected to be talking abstractly. Asking about basic
features and how to fix simple programs is, unfortunately, often
responded to with what many would think of as hostility.
:Is there a way that simple mortals can ask questions how to do things
:with perl/ work with perl.
In practice, you can get away with a fair bit in clpm, if you know
a few key points:
- Do not post just asking whether something will work. The answer
you get back will be some variation on "Well, what happened when you
tried it?"
- If you do not understand something that is in the manuals, then
when you post, you should make sure that your posting shows clearly
that you have *read* the manuals. Do not just say "I don't know
how to do X": say "I've read the man page about X, and this sentance
confuses me, because I would interpret it as meaning Y, but when
I tried doing that with this bit of code, Z, I got back a response
that was different than Y."
- If something seems to be going wrong, then post a *short* example
of code that does not give the result you think it should. And
make sure that you 'use strict' and 'use warnings' in your example,
and that you run the example code -- if you just type the code in
from memory, then people may get hung up about any minor mistakes you
made.
- Take the time to read the manual pages first. Look through all of them,
even if you do not understand them the first time around. Become accustomed
to what -kind- of information is to be found on each manual page.
- Read the perl FAQ (Frequently Asked Questions). Again, if you don't
understand part of one of them the first time, that's okay -- but
if your question is answered in one of the FAQs and it appears that you
did not even *look* there, then people in clpm will often get impatient
with you.
- One of the most important points is that your posting should show
that you *tried*. perl is a big language, and it is okay to not understand
part of it, but people will tend to be most helpful they can tell
that you put some real effort into finding the answer yourself.
- People do not like to feel that you are taking advantage of them,
so never demand an answer or just expect them to fix your program,
and never ever ask people to do your homework for you.
Be polite, show that you are trying, and show that you are here to
learn, not to get others to do things you cannot be bothered to do.
- Try not to take harsh answers too personally. clpm can be stressful,
but keep in mind that the approach that a number of people in the
group have is the "tough love" approach -- not intended to offend,
but intended to teach people how to be more self-sufficient.
Even when you get to a much more advanced stage, and understand much of
what people say, and get to know the people who post a lot, and start
contributing answers yourself, you may still encounter what seems like
hostility from time to time. There are a lot of people who do not read
the newsgroup all the time, and you might get a response from someone
who has not happened to see your previous well-thought answers and
efforts to help people. So *sometimes*, in my experience, what you have
to do is "push back", and firmly (but politely) show the other person
that you know what you are talking about, that their snap answer did
not take some important considerations into account, and that their
answer was not entirely reasonable. Some of the regular posters have a
bit of a tendancy to criticize and "put down" questions that they do
not understand on first reading -- but those same people, once they do
understand, can turn out to be very helpful in suggesting interesting
approaches. Nearly all the regulars have something interesting to say,
once they respect that you are at least -trying-.
The last thing I would suggest, is that if you are going to hang
around clpm for a long time, is to use a newsreader that has a 'killfile'
function. Sometimes 'flamewars' start in clpm, and sometimes you may
find some authors that have interesting points but tend to end up
antagonizing people. It's only a newsgroup, you don't have to read
everything: learn when to ignore discussions or people that are
wearing you down more than they are helping you learn.
--
Rome was built one paycheck at a time. -- Walter Roberson
------------------------------
Date: 25 Apr 2004 23:42:13 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Pipe outputs response to browser
Message-Id: <slrnc8oj6l.bvb.sholden@flexal.cs.usyd.edu.au>
On Sun, 25 Apr 2004 18:31:11 GMT,
Experienced but Undocumented <e01@removethis.toao.net> wrote:
> "Robin" <robin @ infusedlight.net> wrote
>> die usually doesn't output to the browser, you have to trap it with an
> eval
>> call or something like that. If you want to say:
>>
>> open(MAIL, "|/usr/sbin/sendmail -bs") or print
> "Content-Type:text/html\n\n",
>> "Error, I dunno about die calls yet, and neither does Robin" and exit;
> #the
>> output.
>
>
> The script actually isn't dying; it runs, but the browser gets output like
> the following, which is what I want to avoid.
>
> 220-server ESMTP Exim 4.24 #1 Sun, 25 Apr 2004 14:27:02 -0400
> 220-We do not authorize the use of this system to transport unsolicited,
> 220 and/or bulk e-mail.
> 250 server Hello user at TEST
> 250 OK
> 250 Accepted
> 354 Enter message, ending with "." on a line by itself
> 250 OK id=2BHaoLG-00423-Si
> 221 SERVE closing connection
So redirect sendmail's output elsewhere.
Or just use a module which does it all for you.
--
Sam Holden
------------------------------
Date: Sun, 25 Apr 2004 15:16:59 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: Re: slurp not working? ideas please!
Message-Id: <c6hg29$gpf$1@reader2.nmix.net>
> package MyParser;
> use base qw(HTML::Parser);
> use File::Find;
>
> my $in_heading;
> my $p;
>
> my $dir = ("d:/a-keep9/short-nondb/oldshort2");
>
> find sub {
>
> my $name = $_;
>
> open (OUT, ">>d:/a-keep9/short-nondb/short/members2/$name");
>
> print OUT ("<html><head><title>test</title></head><body> \n");
> print OUT ("<table width='100%' border='1'> \n");
>
> sub start {
>
> my ($self, $tagname, $attr, undef, $origtext) = @_;
>
> if ($tagname eq 'h2') {
> $in_heading = 1;
> return;
> }
>
> if ($tagname eq 'p') {
> $p = 1;
> return;
> }
>
> if ($tagname eq 'option') {
>
> choice($attr->{ value });
>
> }
>
> }
>
> sub end {
> my ($self, $tagname, $origtext) = @_;
> if ($tagname eq 'h2') {
> $in_heading = 0;
> return;
> }
>
>
> if ($tagname eq 'p') {
> $p = 0;
> return;
> }
> }
>
> sub text {
> my ($self, $origtext) = @_;
> print OUT ("<h2>$origtext</h2> \n") if $in_heading;
> print OUT ("<p>$origtext</p> \n") if $p;
>
> }
>
> sub choice {
> my ($path) = @_;
>
> if ($path =~ /docs\/aslevel\/classroom-notes/) {
> intro($path);
> classroomnotes($path);
> }
>
> }
>
> sub intro {
>
> my ($pathhere) = @_;
> open (INN, "d:/a-keep9/short-nondb/db/total-160404.txt");
> my $lineintro;
>
> while (defined ($lineintro = <INN>)) {
> if ($lineintro =~ /$pathhere','(.*?)'\)\;/) {
> print OUT ("<tr><td>$1 <p> </td>\n");
> }
> }
> }
>
>
>
> sub classroomnotes {
>
> my ($pattern) = @_;
>
> open (INNN, "d:/a-keep9/short-nondb/allphp/allphp2.php");
>
> my $line = <INNN>;
>
> while (<INNN>){
> last if /$pattern/;
> }
> my ($curr, $next1, $next2, $next3) = <INNN>;
> close (INNN);
>
> if ($next3 =~ /\$i\<(\d+);/) {
> my $nn = $1;
> print OUT ("<td valign='top'> \n");
> for ($c=1;$c<$nn;$c++) {
> print OUT ('<a href="'. $pattern . "-doc" . $c . ".zip" . '">' .
> "Document$c" . "</a><br>" . "\n");
> }
> print OUT ("</td></tr>\n");
> }
> }
>
>
> print OUT ("</body></html> \n");
>
> package main;
> open (IN, $name);
> undef $/;
> my $html = <IN>;
> my $parser = MyParser->new;
> $parser->parse($html);
>
> }, $dir;
hmm... it's hard to read your code... you might want to work on structuring
it a bit. But I'm not the one to talk about that, my code is so funky to
read.
-Robin
------------------------------
Date: Sun, 25 Apr 2004 15:42:01 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: Re: sort numeric lists
Message-Id: <c6hg2a$gpf$2@reader2.nmix.net>
7
"The King of Pots and Pans" <King@ask.for.email.invalid> wrote in message
news:fdjhc.65339$U83.9813@fed1read03...
> On disk I have a 2d table of numbers. Something like this:
>
> 9 8 6
> 4 5 6
>
> I read it in so that I have a list of references to lists. In other
> words, a list of the rows.
>
> I want to first sort by column 2, then column 3. When I sort by column
> 2 I get:
>
> 4 5 6
> 9 8 6
>
> As expected because 5 < 8. When I sort by column 3 I get:
>
> 9 8 6
> 4 5 6
>
> This is unexpected. Since 6 = 6, I don't want it to perform the
> sort. See how it was already sorted by column 2 when column 3 elements
> were equal, but now column 2 is unsorted again.
>
>
> --
> The King of Pots and Pans
haven't learned too much about pointers and references (my books suck), but
I'd like to show you how to sort them if their truly seperated by spaces,
you don't need a fancy sort routine. I saw your other code, and it was too
fancy for such a simple operation. You should always post your code first.
#!/usr/bin/perl
$file = 'nums.txt';
open (FILE, $file) or die "Error: $!";
#flock it
my (@array3, @array2, @array1, $tmp);
@array1 = <FILE>;
close (FILE);
chomp (@array1);
foreach (@array1)
{
@array2 = split (/ /);
@array2 = sort (@array2);
push (@array3, @array2);
}
print @array3;
on a side note- what does this do??
#!/usr/bin/perl
$file = 'nums.txt';
open (FILE, $file) or die "Error: $!";
#flock it
my (@array3, @array2, @array1, $tmp);
@array1 = <FILE>;
close (FILE);
chomp (@array1);
foreach (@array1)
{
@array2 = split (/ /);
@array2 = sort (@array2);
push (@array3, [@array2]);
}
print @array3;
--
Regards,
-Robin
--
[ webmaster @ infusedlight.net ]
www.infusedlight.net
--
------------------------------
Date: 25 Apr 2004 15:28:14 -0700
From: tigermott@yahoo.com (javatiger)
Subject: Tripod wont find my lib files
Message-Id: <962e2a34.0404251428.28daf177@posting.google.com>
Every time I upload a library file into my cgi bin, tripod refuses to
find it and comes up with an error.
It looks like there was an error:
Your script produced this error:
Can't locate File/Glob.pm in @INC (@INC contains: . / /lib /site_perl)
at msg.pl line 8.
BEGIN failed--compilation aborted at msg.pl line 8.
I get usual scripts to work but just can't get the lib ones too.
Is there something I need to be doing?
Cheers
------------------------------
Date: Sun, 25 Apr 2004 23:52:10 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Tripod wont find my lib files
Message-Id: <408C4F17.6030702@rochester.rr.com>
javatiger wrote:
> Every time I upload a library file into my cgi bin, tripod refuses to
-------------------------------------^^^^^^^^^^^^^^^
What's "tripod"?
> find it and comes up with an error.
>
> It looks like there was an error:
>
> Your script produced this error:
> Can't locate File/Glob.pm in @INC (@INC contains: . / /lib /site_perl)
----------------------------------------------------^^^^^^^^^^^^^^^^^^^
Is your "cgi bin" one of the above directories? (hint: your web server
may not start your CGI routines with the current directory being the
directory in which the CGI routines reside). If not, loading a "library
file" there will do no good, as Perl is only searching the directories
in @INC for library routines. Maybe you should instead load the
"library file" into one of those directories. Or put a "use lib ..."
statement into your program which tells Perl to search the place where
you put the files.
> at msg.pl line 8.
> BEGIN failed--compilation aborted at msg.pl line 8.
>
...
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Sun, 25 Apr 2004 15:58:44 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: Re: variable interpolation failed :-(
Message-Id: <c6hhaa$h4u$1@reader2.nmix.net>
"fred" <fred@no-spam.fr> wrote in message
news:pan.2004.04.21.14.30.57.770891@no-spam.fr...
> I just come to find the error : there was a blanck just after $motif and I
> did nit see it ! :-)
>
> Le Wed, 21 Apr 2004 10:17:43 -0400, Paul Lalli a écrit :
>
> > On Wed, 21 Apr 2004, fred wrote:
> >
> >> [texte rapporté caché]
> >
> > Those two code segments do exactly the same thing. If one did what you
> > wanted, so shoudl the other. Therefore, you're either not showing us
> > you're actual code, or there is something else wrong with your program
> > that you've discounted as the possible cause of your bug. Post a *short
> > but complete* program demonstrating the problem you're seeing.
> >
> > BTW, it's "Perl", not "PERL". And also, if you really want to remove
the
> > .pdf extension, wouldn't you want a regexp of
> > s/\.pdf$//;
> > rather than what you have?
> >
> > Paul Lalli
yeah, I was just about to say... also, what if the file's name is
pdfpdf.pdf??? think a little.
it'd be more what Paul just said.
-Robin
------------------------------
Date: Sun, 25 Apr 2004 16:03:13 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: Re: variable interpolation failed :-(
Message-Id: <c6hhab$h4u$3@reader2.nmix.net>
>
> Better check the return value from system() if you care about
> whether the copy worked or not...
>
perl really should have a copy function.
--
Regards,
-Robin
--
[ webmaster @ infusedlight.net ]
www.infusedlight.net
------------------------------
Date: Sun, 25 Apr 2004 16:01:53 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: Re: variable interpolation failed :-(
Message-Id: <c6hhab$h4u$2@reader2.nmix.net>
"fred" <fred@no-spam.fr> wrote in message
news:pan.2004.04.21.20.51.50.13080@no-spam.fr...
> very elegant solution ;-)
>
> because I want the final file name length between 5 and
> $longueur_maxi_titre_final, I changed this line :
>
> my $re =
qr{$source_directory/(.{5,$longueur_maxi_titre_final}).*\.pdf$}o;
thanks for telling us twice...hehe...
-Robin
------------------------------
Date: Sun, 25 Apr 2004 23:46:49 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: variable interpolation failed :-(
Message-Id: <J5Yic.37981$Aq.11428@nwrddc03.gnilink.net>
Robin wrote:
>> Better check the return value from system() if you care about
>> whether the copy worked or not...
>>
>
> perl really should have a copy function.
Please define "copy".
- Do you mean copying a file? What's wrong with File::Copy?
- Do you mean copying a variable? What's wrong with a simple assignment?
- Do you mean copying a complex data structure with references? I think I
heard someone saying there is a module on CPAN.
jue
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6463
***************************************