[22465] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4686 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 9 11:06:36 2003

Date: Sun, 9 Mar 2003 08:05:07 -0800 (PST)
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, 9 Mar 2003     Volume: 10 Number: 4686

Today's topics:
        a minor point about the distinction between arrays and  <bik.mido@tiscalinet.it>
    Re: a minor point about the distinction between arrays  <usenet@tinita.de>
    Re: a minor point about the distinction between arrays  (Tad McClellan)
    Re: any simple way to detect the real end of a command  <mpapec@yahoo.com>
    Re: any simple way to detect the real end of a command  (Anno Siegel)
    Re: Help print 2d array. <wksmith@optonline.net>
        How can I avoid my handler being called as a method han <spamfilter@cheiron-it.nl>
        How to use unzip files to current directory <johndoe44@hotmail.com>
    Re: How to use unzip files to current directory <noreply@gunnar.cc>
    Re: How to use unzip files to current directory (Drew)
    Re: How to use unzip files to current directory <jurgenex@hotmail.com>
    Re: I  want to know the line n umber of the error ! <bart.lateur@pandora.be>
    Re: is a hash the best way to do this? <brad@langhorst.com>
        mod_perl: why are my Handlers called twice? <spamfilter@cheiron-it.nl>
    Re: mod_perl: why are my Handlers called twice? (Randal L. Schwartz)
        Problem with Term::ReadKey on RedHat <marcin94465@nopls_wp.pl>
    Re: Problem with Term::ReadKey on RedHat (Anno Siegel)
    Re: Problem with Term::ReadKey on RedHat <marcin94465@nopls_wp.pl>
    Re: Regular expression question <noreply@gunnar.cc>
    Re: Regular Expressions <bach@nospamworld.com>
    Re: Regular Expressions (Anno Siegel)
        simple while problem <humrattle@hotmail.com>
    Re: simple while problem (Tad McClellan)
    Re: simple while problem <barryk2@SPAM-KILLER.mts.net>
    Re: simple while problem <No_4@dsl.pipex.com>
    Re: simple while problem <jurgenex@hotmail.com>
        Using browser instead of Tk? <d.borland@ntlworld.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 09 Mar 2003 14:40:54 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: a minor point about the distinction between arrays and lists.
Message-Id: <nbem6vcjf1654ibqlj9navsi9kvbak0dof@4ax.com>

Having read the relevant docs (including the faq), I think I have
mostly understood the difference between arrays and lists. However I
still have the feeling that there are some details that are plainly
counter-intuitive.

In particular I have an issue with subscribing the return value(s) of
a function. Thus I can use e.g. '(split /$re/)[0]' to get the first
element or '(reverse split /$re/)[0]' to get the last one without
assigning to an intermediate array var.

But how can I get, say, both the *1st* and the *last* entry? One
obvious answer would be to just do it another way... granted! But IMHO
there are situations in which using a slice would be elegant and
conceptually clear.

OTOH for *named* arrays I can use the $#array construct to access the
last entry of (e.g.) @array. Now I seem to recollect that this syntax
is taken from a shell lingo, but I can hardly imagine a situation in
which one has to use (e.g.) $#a with @b or vice versa...

Wouldn't it be nice if there were an automatic variable to be used
exclusively as a subscript with the meaning of "subscript of last
entry of *this* (possibly anonymous) array"?

I read that Perl6 is expected to offer a much improved treatment of
lists, but what I'd like to know is wether there's any serious reason
why a feature like the one I'm hinting at could be incompatible with
the current language semantic.


Michele
-- 
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth.  See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel on sci.math, thread "Why numbers?"


------------------------------

Date: 9 Mar 2003 13:59:16 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: a minor point about the distinction between arrays and lists.
Message-Id: <tinhbhjl1$165$tina@news01.tinita.de>

Michele Dondi <bik.mido@tiscalinet.it> wrote:
> In particular I have an issue with subscribing the return value(s) of
> a function. Thus I can use e.g. '(split /$re/)[0]' to get the first
> element or '(reverse split /$re/)[0]' to get the last one without
> assigning to an intermediate array var.

to get the first:
 (split //)[0]
to get the last there's no reverse necessary:
 (split //)[-1]

> But how can I get, say, both the *1st* and the *last* entry? One

 (split //)[0,-1]

read about array slices in, err, i think,
 perldoc perldata
and/or
 perldoc perlsyn

> Wouldn't it be nice if there were an automatic variable to be used
> exclusively as a subscript with the meaning of "subscript of last
> entry of *this* (possibly anonymous) array"?

-1

hth, tina

-- 
http://www.tinita.de/     \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/   \     / _` / _ \/ _ \ '_(_-< of
http://www.perlquotes.de/   \    \ _,_\ __/\ __/_| /__/ perception
http://www.tinita.de/peace/link.html - Spread Peace


------------------------------

Date: Sun, 9 Mar 2003 07:56:35 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: a minor point about the distinction between arrays and lists.
Message-Id: <slrnb6mi0j.1kc.tadmc@magna.augustmail.com>

Michele Dondi <bik.mido@tiscalinet.it> wrote:
> Having read the relevant docs (including the faq), I think I have
> mostly understood the difference between arrays and lists. However I
> still have the feeling that there are some details that are plainly
> counter-intuitive.
> 
> In particular I have an issue with subscribing the return value(s) of
                                     ^^^^^^^^^^^
                                     ^^^^^^^^^^^  subscripting

> a function. Thus I can use e.g. '(split /$re/)[0]' to get the first
> element or '(reverse split /$re/)[0]' to get the last one without
> assigning to an intermediate array var.


You can also get the last this way:

   (split /$re/)[-1]


> But how can I get, say, both the *1st* and the *last* entry? One


   (split /$re/)[0, -1]

:-)


> OTOH for *named* arrays I can use the $#array construct 


or '-1'.


> to access the
> last entry of (e.g.) @array. Now I seem to recollect that this syntax
> is taken from a shell lingo, but I can hardly imagine a situation in
> which one has to use (e.g.) $#a with @b or vice versa...


   foreach my $index ( 0 .. $#b )

-1 won't work for generating a list (of indexes for example),
it only works for subscripting.


> Wouldn't it be nice if there were an automatic variable to be used
> exclusively as a subscript with the meaning of "subscript of last
> entry of *this* (possibly anonymous) array"?


We already have it.


> I read that Perl6 is expected to offer a much improved treatment of
> lists, but what I'd like to know is wether there's any serious reason
> why a feature like the one I'm hinting at could be incompatible with
> the current language semantic.


It won't be incompatible since it is already there.  :-)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sun, 09 Mar 2003 11:46:10 +0100
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: any simple way to detect the real end of a command in a perl script?
Message-Id: <3m6m6vs7d3qasvu9to84uchbkhu5ghjr44@4ax.com>

X-Ftn-To: Abigail 

Abigail <abigail@abigail.nl> wrote:
>{}  Similarly, if I see an enclosing }, how do I know whether that is the
>{}  end of a code block and not part of a hash notation, or part of a
>{}  string value, or a here doc or a regex, etc.
>
>You will have to parse Perl. Note that even perl itself doesn't always
>guess right whether a '{' starts a code block, or a hash reference.

what it does in such case, flips a coin? :)



-- 
Matija


------------------------------

Date: 9 Mar 2003 11:31:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: any simple way to detect the real end of a command in a perl script?
Message-Id: <b4f8m8$eud$2@mamenchi.zrz.TU-Berlin.DE>

Matija Papec  <mpapec@yahoo.com> wrote in comp.lang.perl.misc:
> X-Ftn-To: Abigail 
> 
> Abigail <abigail@abigail.nl> wrote:
> >{}  Similarly, if I see an enclosing }, how do I know whether that is the
> >{}  end of a code block and not part of a hash notation, or part of a
> >{}  string value, or a here doc or a regex, etc.
> >
> >You will have to parse Perl. Note that even perl itself doesn't always
> >guess right whether a '{' starts a code block, or a hash reference.
> 
> what it does in such case, flips a coin? :)

No, in doubt it prefers the hash ref:

    perl -we '{}'
Useless use of single ref constructor in void context at -e line 1.

    perl -we '{;}'
[silence]

Anno


------------------------------

Date: Sun, 09 Mar 2003 05:00:27 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Help print 2d array.
Message-Id: <LTzaa.71197$gf7.14689287@news4.srv.hcvlny.cv.net>


"Joe Creaney" <mail@annuna.com> wrote in message
news:3E6A4D08.3040109@annuna.com...
>
>--snio--
> sub pgrid {
>
> my ($xp,$yp) = @_;
> my $l;
> my $l1;
> my @grd=(
>          [ qw( . . . . . )],
>          [ qw( . . . . . )],
>          [ qw( . . . . . )],
>          [ qw( . . . . . )],
>          [ qw( . . . . . )],
>            );
>
> print "Printing Grid \n";
>
> #######foreach $l (@grd) {
   for ($l=0; $l<@grd; $l++){
>
> #######       for ( $l1=0; $l1 >4; $l1++) {
         for ( $l1=0; $l1 <=4; $l1++) {
>                  if (($l == $xp) and ($l1 == $yp)) {
>                  print "*"; } else {
>                  print "$grd[$l] [$l1]"; }
>
>                 print "$l  $l1";
>                  }
>         print "\n";
>         print "$grd[$l][$l1]";
>
>         }
>
> }
-snip--

The original $l is not an index.  It is a reference to the current row
of the grid.  In my first correction, @grd is the number of rows in the
grid.

My second correction assumes that there are always four columns in the
grid.

Good Luck,
Bill






------------------------------

Date: Sun, 9 Mar 2003 14:17:49 +0100
From: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: How can I avoid my handler being called as a method handler?
Message-Id: <3e6b4000$0$129$e4fe514c@dreader4.news.xs4all.nl>

Hi,

I am working on a site where all pages are handled via an Apache::SSI
descendant. Some included parts are itself mod_perl routines that
use the instance-methode to recreate the request. The routines work
fine if used "standalone" but as soon as the routine gets included
via the SSI method (subrequest?) apache/mod_perl complains. The call
to instance results in an error 'can't locate method 'pnotes' via
package "X::Y::Z"', where X::Y::Z is my own package.
After some debugging I found that the handler is called as if it were
a method handler (first argument is $self and not the request). But
why? The subroutine is not defined with the ($$) prototype.

Most probably the error is in me, can you help me point it out...

--Frank





------------------------------

Date: Sun, 09 Mar 2003 08:08:01 GMT
From: Steve Monty <johndoe44@hotmail.com>
Subject: How to use unzip files to current directory
Message-Id: <3E6AF660.6010109@hotmail.com>

Hi,

I'm using the system command "unzip" to unzip a file.

system ("unzip ../zipdir/zipfile.zip");

The problem is that it unzips the file to my cgi directory. What do I 
need to add to unzip the file to the directory where the zipfile 
resides? I want to wind up with:

    zipdir
        zipfile.zip
        zipfile1.jpg
        zipfile2.jpg
        zipfile3.jpg

Monty



------------------------------

Date: Sun, 09 Mar 2003 09:54:53 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to use unzip files to current directory
Message-Id: <b4evh6$1uv67t$1@ID-184292.news.dfncis.de>

Steve Monty wrote:
> I'm using the system command "unzip" to unzip a file.
> 
> system ("unzip ../zipdir/zipfile.zip");
> 
> The problem is that it unzips the file to my cgi directory. What do I 
> need to add to unzip the file to the directory where the zipfile 
> resides? I want to wind up with:
> 
>    zipdir
>        zipfile.zip
>        zipfile1.jpg
>        zipfile2.jpg
>        zipfile3.jpg

     chdir '../zipdir';
     system (unzip zipfile.zip);

An alternative is to make use of the CPAN module

     Archive::Zip

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Sun, 09 Mar 2003 09:57:12 GMT
From: drew@sundawg.org (Drew)
Subject: Re: How to use unzip files to current directory
Message-Id: <YdEaa.19340$5P1.9550@fe07.atl2.webusenet.com>

In article <3E6AF660.6010109@hotmail.com>, johndoe44@hotmail.com says...

>The problem is that it unzips the file to my cgi directory. What do I 
>need to add to unzip the file to the directory where the zipfile 
>resides? I want to wind up with:
>
>    zipdir
>        zipfile.zip
>        zipfile1.jpg
>        zipfile2.jpg
>        zipfile3.jpg

well, a quick "unzip -h" seems to answer the question.  Look at the -d flag.

Drew




------------------------------

Date: Sun, 09 Mar 2003 14:53:30 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to use unzip files to current directory
Message-Id: <KzIaa.2121$qB5.1921@nwrddc01.gnilink.net>

Steve Monty wrote:
> I'm using the system command "unzip" to unzip a file.
>
> system ("unzip ../zipdir/zipfile.zip");
>
> The problem is that it unzips the file to my cgi directory. What do I
> need to add to unzip the file to the directory where the zipfile
> resides?

Because you are posting to a Perl newsgroup I assume you are looking for a
more Perlish replacement of that non-portable and inefficient code (why
forking a new process and launching an external program?).

use Archive::Zip

    The Archive::Zip module allows a Perl program to create, manipulate,
    read, and write Zip archive files.

jue




------------------------------

Date: Sun, 09 Mar 2003 12:52:22 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: I  want to know the line n umber of the error !
Message-Id: <fhdm6vsf7pk1knr9irpfi7p5on9oambkaq@4ax.com>

Tore Aursand wrote:

>On Fri, 07 Mar 2003 11:05:04 +0000, Helgi Briem wrote:
>>> Funny as it is, though; I myself requested a lightweight CGI
>>> replacement earlier today. *g*
>
>> There are certainly plenty of those around.
>> 
>> CGI::Simple;
>
>Last updated: 09-Nov-2002
>
>> CGI::Minimal;
>
>Last updated: 10-Apr-2002

>> CGI::Request;
>
>Last updated: Didn't find this one...?

It comes with Perl, IIRC. ANyway, it's written by the same author,
Lincoln Stain, as CGI.pm itself.

It's not because CGI.pm gets a later update, that it's updated in one of
the for you relevant functions. It's *because* CGI.pm is so bulky, that
you may expect more frequent updates.

>Anyway;  Which one of these do you prefer?

Hmm..; undecided.

There's also CGI::Lite.

-- 
	Bart.


------------------------------

Date: Sun, 09 Mar 2003 13:59:38 GMT
From: Brad Langhorst <brad@langhorst.com>
Subject: Re: is a hash the best way to do this?
Message-Id: <eNHaa.10525$wJ1.1003344@newsread2.prod.itd.earthlink.net>

david wrote:

> Thanks. This works in all but the cases where the comment field is set
> to "". It looks like this is happening if a comments field is
> something like this:
> Comment: (some text)
> When it does the search/replace on these records, it writes the
> $uid{$key} as a blank. Any ideas to not process these records? My
> previous code checked to make sure it has a value before executing the
> replace:
> if (!($keyname eq "") && !($keyvalue eq ""))
>
did you try a 
next if $comment == "" after the find_comment in the first loop?
is that what you want to do "skip blank comment fields?
if not you could set $comment to something else before the hash assignment

brad


------------------------------

Date: Sun, 9 Mar 2003 14:15:15 +0100
From: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: mod_perl: why are my Handlers called twice?
Message-Id: <3e6b3f65$0$118$e4fe514c@dreader4.news.xs4all.nl>

Hi,

I am at the end of my knowledge here.... I try to set up a site that
massively
uses Perl*Handlers, but as soon as I activate the PerlHandler then some of
the other handlers get called twice (for the request url and one level
deeper).

See this example:

<Location />
  # SetHandler perl-script
  PerlHeaderparserHandler MyClass->first
  PerlAuthenHandler MyAuthen
  PerlFixupHandler MyClass->init
  # PerlHandler MyClass->handler
  PerlCleanupHandler MyClass->last
</Location>

I have stripped almost all functionality and just let the subroutines
print. With this setup and a 'get http://mysite/dir/file' I see:
-- first: got /dir/file
---- authen: called for /dir/file
---- init: called for /dir/file
[error] ... /dir/file not found
-- last:  finished /dir/file

No strange things, what I would expect. But now I remove the comments
before SetHandler and PerlHandler and see what happens:

-- first: got /dir/file
---- authen: called for /dir/file
---- init: called for /dir/file
---- authen: called for /file
---- init: called for /file
---- handler: called for /dir/file
[error] ... /dir/file not found
-- last:  finished /dir/file

What strike me are the two lines for /file. Why is this happening? I
did not ask for it, at least not deliberately. Is this something
that is related to a Handler (check one level below the uri)?

Hope you can help me here.

--Frank




------------------------------

Date: Sun, 09 Mar 2003 15:37:20 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: Re: mod_perl: why are my Handlers called twice?
Message-Id: <49be54497d741c6219e7fba2e7e432b0@news.teranews.com>

>>>>> "Frank" == Frank Maas <spamfilter@cheiron-it.nl> writes:

Frank> No strange things, what I would expect. But now I remove the comments
Frank> before SetHandler and PerlHandler and see what happens:

Frank> -- first: got /dir/file
Frank> ---- authen: called for /dir/file
Frank> ---- init: called for /dir/file
Frank> ---- authen: called for /file
Frank> ---- init: called for /file
Frank> ---- handler: called for /dir/file
Frank> [error] ... /dir/file not found
Frank> -- last:  finished /dir/file

Frank> What strike me are the two lines for /file. Why is this happening? I
Frank> did not ask for it, at least not deliberately. Is this something
Frank> that is related to a Handler (check one level below the uri)?

It's very likely that Apache is running a sub-request to translate
the PATH_INFO into PATH_TRANSLATED.

If you don't want to provide authen info for such a subquery, be
sure to reject subqueries in your handler.

This question might be better answered on the mod_perl mailing list.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Sun, 9 Mar 2003 10:32:57 +0100
From: "mrtn" <marcin94465@nopls_wp.pl>
Subject: Problem with Term::ReadKey on RedHat
Message-Id: <b4f1fg$k1n$1@foka.acn.pl>

Hi,

this question was asked a few weeks ago - but there was no response. When I
use the basic example from perlfaq :

use Term::ReadKey;
ReadMode('cbreak');
if (defined ($char = ReadKey(-1)) ) {
        # input was waiting and it was $char
} else {# no input was waiting}
ReadMode('normal');

the program stops at ReadKey line and doesn't respond to keybord input. I
use RedHat 8.0 with kernel version 2.4.18-14. Maybe someone solved this
problem.

Thanx





------------------------------

Date: 9 Mar 2003 11:21:15 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem with Term::ReadKey on RedHat
Message-Id: <b4f83b$eud$1@mamenchi.zrz.TU-Berlin.DE>

mrtn <marcin94465@nopls_wp.pl> wrote in comp.lang.perl.misc:
> Hi,
> 
> this question was asked a few weeks ago - but there was no response. When I
> use the basic example from perlfaq :
> 
> use Term::ReadKey;
> ReadMode('cbreak');
> if (defined ($char = ReadKey(-1)) ) {
>         # input was waiting and it was $char
> } else {# no input was waiting}
> ReadMode('normal');
> 
> the program stops at ReadKey line and doesn't respond to keybord input. I

No, it doesn't compile.  The final "}" of the "else" clause ended up in
a comment.

> use RedHat 8.0 with kernel version 2.4.18-14. Maybe someone solved this
> problem.

With the error corrected, it runs for me as advertised.

Anno


------------------------------

Date: Sun, 9 Mar 2003 17:07:02 +0100
From: "mrtn" <marcin94465@nopls_wp.pl>
Subject: Re: Problem with Term::ReadKey on RedHat
Message-Id: <b4foid$47c$1@foka.acn.pl>


"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> > this question was asked a few weeks ago - but there was no response.
When I
> > use the basic example from perlfaq :
> >
> > use Term::ReadKey;
> > ReadMode('cbreak');
> > if (defined ($char = ReadKey(-1)) ) {
> >         # input was waiting and it was $char
> > } else {# no input was waiting}
> > ReadMode('normal');
> >
> > the program stops at ReadKey line and doesn't respond to keybord input.
I
>
> No, it doesn't compile.  The final "}" of the "else" clause ended up in
> a comment.
>
> > use RedHat 8.0 with kernel version 2.4.18-14. Maybe someone solved this
> > problem.
>
> With the error corrected, it runs for me as advertised.

Thanks for response ;) , but it still doesn't work for me, here is what I
actually want to achive:

#!/usr/bin/perl -w
use Term::ReadKey;
sub test
{
    ReadMode('cbreak');
    my $key="e";
    while($key ne "q")
    {
        if (defined($char = ReadKey(-1)))
        {
            $key=$char;
            print $key,"\n";
        }
    }
    ReadMode('normal');
}
test();

this should print all the keyboard input and leave "while" after
encountering "q" , but the $char never gets defined, and execution never
enters statements inside the "if" . I hope that I am not misunderstanding
the use of ReadKey() , anyway thanks for any help.

Marcin





------------------------------

Date: Sun, 09 Mar 2003 08:40:08 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Regular expression question
Message-Id: <b4er4u$1v8s31$1@ID-184292.news.dfncis.de>

Z wrote:
> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> : Thanks for correcting me, Anno. Sorry for possible confusion.
> 
> So, then, is it not possible?

It depends on what exactly you mean by "it". You'd better evaluate 
Michael's reply to your question. (I just made a mistake.)

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Sun, 09 Mar 2003 06:25:50 GMT
From: "bach" <bach@nospamworld.com>
Subject: Re: Regular Expressions
Message-Id: <O7Baa.203141$Zr%.84562@news01.bloor.is.net.cable.rogers.com>

> Pseudo-code is one thing, sloppiness is another.

Yes, I guess my typos where sloppy, but it still was pseudo-code, so your
comment is irrelevant.  Please try to stay away from these petty arguments.
Not much ego satisfastion to win here.

> So?  You got lucky.

So?  Am I supposed to feel bad because I got lucky?  Isn't it enough that
someone was able to understand my code samples and provide constructive
guidance? Why must you hang so tightly on this insignificance?  Again,
please try to stay away from these petty arguments.

> For those of us who try to answer questions, innocent little posts like
> yours sum up to a huge waste of time.  Fear and disdain are not involved.

If it's a huge waste of time, leave the posts unanswered!  I certainly am
not forcing anyone to reply and I definitely couldn't care less as to the
reasons why some people (smart and oh-so-meticulous as they may be) did not
answer.

Talking of waste of time, this exchange is childish and isn't going anywhere
so let's agree to disagree and leave it at that.

b@




------------------------------

Date: 9 Mar 2003 13:27:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regular Expressions
Message-Id: <b4fffk$k40$1@mamenchi.zrz.TU-Berlin.DE>

bach <bach@nospamworld.com> wrote in comp.lang.perl.misc:
> > Pseudo-code is one thing, sloppiness is another.
> 
> Yes, I guess my typos where sloppy, but it still was pseudo-code, so your
> comment is irrelevant.

Pseudo-code is used by experienced programmers to explain well-understood
solutions without the syntactic restrictions of one particular programming
language.  You must know and understand the code before you can derive
pseudo-code from it.  You cannot express a problem you don't understand
in pseudo-code.

Far less is pseudo-code an excuse to scribble away and let the reader
figure it out.

We see this argument "you can't criticize it, it was only pseudo-code"
quite often.  It is a pseudo-argument.

Anno


------------------------------

Date: Sun, 9 Mar 2003 14:45:30 +0100
From: "Hum Rattle" <humrattle@hotmail.com>
Subject: simple while problem
Message-Id: <b4fgh9$1t98ph$1@ID-63849.news.dfncis.de>

Hello,

i am new to perl and i try to do this :

while(($i >= 1) || ($b ne $c)) { do something }

this don't seem to work...
whats wrong with the while syntax?

thanks
yours
hum





------------------------------

Date: Sun, 9 Mar 2003 08:03:17 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: simple while problem
Message-Id: <slrnb6mid5.1kc.tadmc@magna.augustmail.com>

Hum Rattle <humrattle@hotmail.com> wrote:

> while(($i >= 1) || ($b ne $c)) { do something }
> 
> this don't seem to work...


What does "don't seem to work" mean when you say it?

What did you expect it to do?

What is it doing instead of what you expected it to do?

If you give us a short and *complete* program that we can run
that illustrates your problem, then we can help you fix it.

If you don't, we can't.


> whats wrong with the while syntax?


Nothing.


But you already knew that there was nothing wrong with the syntax.

If there was something wrong with the syntax, you would get a
syntax error and the program would not even run.

There may, however, be something wrong with the *semantics* of
your while loop (but we can't tell, because we do not know what
meaning you wanted your while loop to have).

Mistakes in syntax are nearly always very easy to find, a machine
can do it. It is mistakes in semantics that are hard(er) to find,
most often requiring application of a human intelligence.

Do not confuse "syntax" with "semantics", they are 
wildly different concepts.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sun, 9 Mar 2003 08:10:30 -0600
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: simple while problem
Message-Id: <MPG.18d50752f1903bf8989737@news.mts.net>



In article <b4fgh9$1t98ph$1@ID-63849.news.dfncis.de>, Hum Rattle 
(humrattle@hotmail.com) says...
> Hello,
> 
> i am new to perl and i try to do this :
> 
> while(($i >= 1) || ($b ne $c)) { do something }
> 
> this don't seem to work...
> whats wrong with the while syntax?
> 
> thanks
> yours
> hum
> 
> 
> 
> 

The syntax looks good. What was the error message from Perl ?

-- 
---------

Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com


------------------------------

Date: Sun, 09 Mar 2003 14:16:06 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: simple while problem
Message-Id: <3e6b4ca7$0$5370$cc9e4d1f@news.dial.pipex.com>

Hum Rattle wrote:> Hello,
> 
> i am new to perl and i try to do this :
> 
> while(($i >= 1) || ($b ne $c)) { do something }
> 
> this don't seem to work...
> whats wrong with the while syntax?

    You want to know what is wrong with your program, not what is wrong 
with the syntax, so post a small (non-)working example, and the error 
mesage (if any).

    One guess is, have you set $i before trying to enter the loop?  If 
not, it will be treated as 0 in the while test, this is not >= 1, so the 
loop codde will never run.


-- 
      -*-    Just because I've written it here doesn't    -*-
      -*-    mean that you should, or I do, believe it.   -*-



------------------------------

Date: Sun, 09 Mar 2003 14:57:07 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: simple while problem
Message-Id: <7DIaa.2127$qB5.64@nwrddc01.gnilink.net>

Hum Rattle wrote:
> i am new to perl and i try to do this :
>
> while(($i >= 1) || ($b ne $c)) { do something }
>
> this don't seem to work...
> whats wrong with the while syntax?

For all I can tell it's perfectly legal syntax  (except for the "do
something" inside of the block).
What compiler errors did you get?

jue




------------------------------

Date: Sun, 9 Mar 2003 15:49:55 -0000
From: "d.borland" <d.borland@ntlworld.com>
Subject: Using browser instead of Tk?
Message-Id: <qpJaa.1275$Nf4.278@newsfep1-gui.server.ntli.net>

Hi all,

I was wondering if there is a way to use perl to communicate with a web
browser without having to run a web server?

Basically i am looking to create a GUI front end to for a database like
program and would rather not have to learn pTk for this.  Thus the reason
for wondering about using a web browser as an average browsers capabilities
will be more than sufficent.  As i am wanting to make this program as
portable as possible this would also help, unless of course the user would
need to have a web server running on their machine, as the script/program
and browser would need to be able to pass data to and from each other while
running (which would obviously not be so good).

I am using a Win32 macinhe though would prefer any ideas to be no-platform
independent.  Though any help you can give is much appreciated.

Thanks




------------------------------

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 4686
***************************************


home help back first fref pref prev next nref lref last post