[23857] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6060 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 1 00:05:43 2004

Date: Sat, 31 Jan 2004 21:05:06 -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           Sat, 31 Jan 2004     Volume: 10 Number: 6060

Today's topics:
    Re: can't find cgi-bin (Walter Roberson)
    Re: can't find cgi-bin <flavell@ph.gla.ac.uk>
    Re: can't find cgi-bin <tadmc@augustmail.com>
    Re: can't find cgi-bin <jurgenex@hotmail.com>
        Clarifications <edgrsprj@ix.netcom.com>
    Re: Clarifications <tadmc@augustmail.com>
    Re: Clarifications <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Clarifications <edgrsprj@ix.netcom.com>
    Re: Clarifications <jwkenne@attglobal.net>
        difficult substitution patterns (Peter)
    Re: difficult substitution patterns <tadmc@augustmail.com>
    Re: difficult substitution patterns <jwkenne@attglobal.net>
    Re: HELP: from XML to mySQL <holyzarquongod@optusnet.com.au>
        Historical <edgrsprj@ix.netcom.com>
    Re: Historical <usenet@morrow.me.uk>
    Re: Historical <sbryce@scottbryce.com>
    Re: Historical (Walter Roberson)
        Newbie question.  Get list of files in subdir. <DHxxxx@inette.com>
    Re: Newbie question.  Get list of files in subdir. (Walter Roberson)
    Re: Newbie question.  Get list of files in subdir. <jurgenex@hotmail.com>
    Re: Newbie question.  Get list of files in subdir. <drumspoorly@reachone.net>
    Re: Perl For Amateur Computer Programmers <tassilo.parseval@rwth-aachen.de>
    Re: Perl For Amateur Computer Programmers <jwillmore@remove.adelphia.net>
    Re: Perl For Amateur Computer Programmers <matthew.garrish@sympatico.ca>
    Re: Perl For Amateur Computer Programmers <matthew.garrish@sympatico.ca>
        print matching elements of a list <nobody@tatooine.homelinux.net>
    Re: print matching elements of a list (Walter Roberson)
    Re: print matching elements of a list <wherrera@lynxview.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 31 Jan 2004 23:05:04 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: can't find cgi-bin
Message-Id: <bvhcb0$155$1@canopus.cc.umanitoba.ca>

In article <401C257A.F8514DA9@collegesherbrooke.qc.ca>,
John Taylor-Johnston  <jt.johnston@USherbrooke.ca> wrote:
:Sigh. Newsgroups are for asking for help.

But -this- newsgroup is not for help with the configuration of
your WWW server -- not unless your WWW server is written in perl.
Try the comp.infosystems.www.servers.* hierarchy.

Your server is Apache/1.3.29 (Unix) PHP/4.3.4 and is a virtual server
run by jonctioninter.net. Read their FAQ at
http://www.jonctioninter.net/en/tech/www-laz.html#scripts_cgi


:I must have one, even if I cannot see it. If I type:
:http://www.glquebec.org/cgi-bin/

:I do get a 403 error, which tells me something; in fact:
:"You don't have permission to access /cgi-bin/ on this server"

It probably also tells you that automatic directory index generation
is turned off and there is no index.html file in that directory.

But that's nothing to do with perl.
-- 
   History is a pile of debris               -- Laurie Anderson


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

Date: Sat, 31 Jan 2004 22:55:11 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: can't find cgi-bin
Message-Id: <Pine.LNX.4.53.0401312251580.7469@ppepc56.ph.gla.ac.uk>


On Sat, 31 Jan 2004, John Taylor-Johnston blots his copybook by
blurting out atop a fullquote:

> Sigh. Newsgroups are for asking for help.

Get real.  This is usenet, not a help desk.

> I must have one, even if I cannot see it.

The killfile is ready and waiting.  Now let's see what you had been
told:

> > The best thing to do is ask your support people.

Hmmm, that's not a bad idea, you know.

Otherwise you could ask in a WWW servers configuration group.  You are
most certainly off-beam here.


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

Date: Sat, 31 Jan 2004 20:20:16 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: can't find cgi-bin
Message-Id: <slrnc1ooj0.tbq.tadmc@magna.augustmail.com>

John Taylor-Johnston <taylorjo@collegesherbrooke.qc.ca> wrote:

> Sigh. Newsgroups are for asking for help.


Yes, but *this* newsgroup is for asking for help with _Perl_.

You do not need help with Perl.

You need help with web servers or the CGI.

Try asking in a newsgroup that is actually about web servers or the CGI.



[ snip TOFU ]

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


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

Date: Sun, 01 Feb 2004 04:22:58 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: can't find cgi-bin
Message-Id: <Ca%Sb.9295$9a4.6564@nwrddc01.gnilink.net>

John Taylor-Johnston wrote:
> Anyone have an idea where I can find my cgi-bin? I can't run a script
> to find it.

Well, if you can't run a Perl script, why not run a simple "find" command?
 Of course this has nothing to do with Perl

> Bizarre oh bizarre. My Home directory is this:
>
> /home/users/q/qx04t9mu/www

The try "find /home/users/q/qx04t9mu/www -name cgi-bin". Please check the
syntax, it has been a while since I used "find".

> but of  course, I can only see /www as my root.

You know about the "cd" command, do you?

jue




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

Date: Sun, 01 Feb 2004 00:55:25 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Clarifications
Message-Id: <18YSb.4653$jH6.1518@newsread1.news.atl.earthlink.net>

"edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
news:qkOSb.4022$jH6.3447@newsread1.news.atl.earthlink.net...

First, the Perl program that I downloaded and installed was the MSI program
and not the AS package.  That information has been corrected on my Web page.
And remember, I stated that this was a trial run version of the Web page
which I was telling people about just to get some comments on the general
idea and contents.

Next, that Web page is not intended to teach people how to be Perl
programmers.  Rather it is intended to do the following:

If you are not a professional computer programmer and you would like to see
if Perl might be useful for your purposes then as far as I can see you are
out of luck.  It is so complex that you will never be able to even test it.
You would have to either take a class on it or spend weeks or more going
through the documentation.  And probably relatively few people are going to
do that.

What that Web page presently does is provide people with groups of
instructions which will let them try the program.  If they download and
install it and then use those codes exactly as I have written them,
substituting their own file names etc., in as little as 10 to 30 minutes
they should be able to create a program which will open a file, read
information from it, do some calculations on the information, store the
results in another file, close all the files, and then open the output file
with some Windows program such as Notepad or whatever and work with it.

Once they are able to do that they can then make a decision regarding
whether or not they wish to learn how to use Perl or instead choose some
other program.  Without that Web page they have no options at all as far as
I can see.  I believe that it is virtually impossible for someone who is not
a computer programming expert to get the program to do enough things that
they can decide if they want to use it.  However, with the information on
that Web page they can at least give it a try.  It is actually a nice
program to use if you have clearly defined routines you can try instead of
having to spend large amounts of time on efforts to learn how to get each
and every command or statement to work.

Regarding style, that Web page is for the most part intended for other
scientists like myself.  I believe that that is exactly the type of
information they would want, explained in terms which they can understand.
Experienced computer programmers might not like the style or content.  But
they already have documentation which they can use with their Perl work.  I
do not think that this is presently the case for many and perhaps most
scientists.  Without that Web page they might try installing Perl, attempt
to write a program, quite in frustration, and then move on to something
else, never to return.

What impact is that Web page likely to have on the world of Perl
programming?

Probably absolutely none.  It is not really intended to move the science
forward.  As I said, it is largely intended to simply open the door for
people who want to see if Perl is a language they might want to use.
Without the information on that Web page they might never be able to give it
a try.




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

Date: Sat, 31 Jan 2004 20:08:46 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Clarifications
Message-Id: <slrnc1onte.tbq.tadmc@magna.augustmail.com>

edgrsprj <edgrsprj@ix.netcom.com> wrote:

> If you are not a professional computer programmer and you would like to see
> if Perl might be useful for your purposes then 


Take a pause and see if Python might suit you better.

Have you evaluated Python for this purpose?


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


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

Date: Sat, 31 Jan 2004 18:45:57 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Clarifications
Message-Id: <59phvb.00n.ln@goaway.wombat.san-francisco.ca.us>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

On 2004-02-01, Tad McClellan <tadmc@augustmail.com> wrote:
> edgrsprj <edgrsprj@ix.netcom.com> wrote:
>
>> If you are not a professional computer programmer and you would like to see
>> if Perl might be useful for your purposes then 
>
> Take a pause and see if Python might suit you better.
>
> Have you evaluated Python for this purpose?

That's not a very nice thing to do to the Python folks.  What have they
ever done to you?  ;-)

- --keith

- -- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAHGhhhVcNCxZ5ID8RAl57AKCddmjzQ7EzK8eBhZNAI2ayd5G4NACcDXvK
b8PqgbAxNBAGU2FcIWvHTbY=
=lmvq
-----END PGP SIGNATURE-----


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

Date: Sun, 01 Feb 2004 03:00:11 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Clarifications
Message-Id: <%YZSb.4752$jH6.2147@newsread1.news.atl.earthlink.net>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnc1onte.tbq.tadmc@magna.augustmail.com...
> edgrsprj <edgrsprj@ix.netcom.com> wrote:
> Take a pause and see if Python might suit you better.
>
> Have you evaluated Python for this purpose?
>

I haven't looked at Python.  Can it be used for CGI work.  How do you get a
version to test?





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

Date: Sun, 01 Feb 2004 03:58:55 GMT
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: Clarifications
Message-Id: <3Q_Sb.19214$gw3.9159529@news4.srv.hcvlny.cv.net>

edgrsprj wrote:

> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnc1onte.tbq.tadmc@magna.augustmail.com...
> 
>>edgrsprj <edgrsprj@ix.netcom.com> wrote:
>>Take a pause and see if Python might suit you better.
>>
>>Have you evaluated Python for this purpose?
>>
> 
> 
> I haven't looked at Python.  Can it be used for CGI work.  How do you get a
> version to test?

Actually, a better language for the purpose would probably be Ruby.  It 
has modern features at its heart that PERL only added on later, and 
requires less understanding of obscure technical notions to do everyday 
things.

news:comp.lang.ruby
http://www.ruby-lang.org

There is a nice Ruby-for-Windows all-in-one, including a convenient 
editor and a good textbook, at
http://sourceforge.net/project/showfiles.php?group_id=67007
I suggest using ruby180-10, rather than ruby181-11 at present.  The 
newer one is only a few days old, and has some packaging problems.

Ruby has a large class library, including CGI and the like.  As a 
general rule, Ruby's libraries are more neatly designed than PERL's, 
though not always as solid.  (Another result of Ruby being a younger 
language.)

-- 
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
   -- Charles Williams.  "Judgement at Chelmsford"


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

Date: 31 Jan 2004 17:06:58 -0800
From: peter_holmes2003@yahoo.com (Peter)
Subject: difficult substitution patterns
Message-Id: <9e41635d.0401311706.d99c936@posting.google.com>

I am relative newbie to perl . i am reading programming perl to learn
perl. In the chanper on pattern matching I came across the following
sustitutions that I can't understand completely. It would be great if
someone could explain these.

Thanks in advance

a)
#put commas in the right place in an integer

1 while s/(\d) (\d\d\d) (?!\d)/$1,$2; 
# what does this mean (?!\d) and what purpose does it serve

b)
#remove (nested (even deeply nested (like this))) remarks

1 while s/\([^()]*\)//g; 
# why escape the first ( and second ), what about the ( or ) in
between


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

Date: Sat, 31 Jan 2004 20:17:47 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: difficult substitution patterns
Message-Id: <slrnc1ooeb.tbq.tadmc@magna.augustmail.com>

Peter <peter_holmes2003@yahoo.com> wrote:

> It would be great if
> someone could explain these.

> a)
> #put commas in the right place in an integer
> 
> 1 while s/(\d) (\d\d\d) (?!\d)/$1,$2; 


That can't be the right code. It does not compile...


> # what does this mean (?!\d) 


Did you look it up in the std docs yet?


   perldoc perlre

      ...
      A zero-width negative look-ahead assertion.
      ...


> and what purpose does it serve


To ensure that the 3 digit chars that are matched are the
last (rightmost) possible chars.


> b)
> #remove (nested (even deeply nested (like this))) remarks
> 
> 1 while s/\([^()]*\)//g; 
> # why escape the first ( and second ), 


Because parenthesis are regex metacharacters.

You must backslash them to match literal parenthesis characters.


> what about the ( or ) in
> between


Parenthesis are not metacharacters in a character class,
so they need no escaping there.

There are only 4 metacharacters in character classes:

   ]       # ends the class, unless it is first

   ^       # negates the class if it first

   -       # forms a range, unless it is first or last

   \       # for escaping the other metachars


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


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

Date: Sun, 01 Feb 2004 03:32:22 GMT
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: difficult substitution patterns
Message-Id: <ar_Sb.18963$gw3.9065623@news4.srv.hcvlny.cv.net>

Peter wrote:

> I am relative newbie to perl . i am reading programming perl to learn
> perl. In the chanper on pattern matching I came across the following
> sustitutions that I can't understand completely. It would be great if
> someone could explain these.
> 
> Thanks in advance
> 
> a)
> #put commas in the right place in an integer
> 
> 1 while s/(\d) (\d\d\d) (?!\d)/$1,$2; 
> # what does this mean (?!\d) and what purpose does it serve

The correct form of the line is:
1 while s/(\d)(\d\d\d)(?!\d)/$1,$2/;

The (?!\d) is what is known as a zero-width assertion.  It means that 
after the (\d) and the (\d\d\d) there is _not_ another \d.  That it is a 
"zero-width assertion" means that the thing it matches doesn't count as 
part of the match; it's just checked.

Let's say that we are processing 12345678.

We try the match.  The first thing that works is the '5' (which matches 
'(\d)'), the '678' (which matches '(\d\d\d)') and the end, which is not 
a \d.

That changes $_ to '12345,678'.  Because the s/.../.../ worked, we 
repeat the while.  This time, the first thing that works is the '2' 
(which matches '(\d)'), the '345' (which matches '(\d\d\d)'), and the 
',', which is not a \d.

That changes $_ to '12,345,678.  The comma after the '5' is not changed 
because '(?!\d)' is a zero-width assertion, and therefore doesn't count 
as part of the match, and therefore is not part of what is replaced. 
Because the s/.../.../ worked, we repeat the match a third time, but 
there isn't another match, and so the while terminates.

> b)
> #remove (nested (even deeply nested (like this))) remarks
> 
> 1 while s/\([^()]*\)//g; 
> # why escape the first ( and second ), what about the ( or ) in
> between

The escapes are there to indicate that they are literal parentheses to 
be scanned for, not grouping operators in regular-expression language.

The escapes are not within the [] because parentheses have no meaning 
within [], and are therefore automatically taken as literal.

To expand, the regular expression means this:

Match on a (, followed by zero or more characters that are not ( or ), 
followed by a ).

The first time, we get "remove (nested (even deeply nested )) remarks".
The second time, we get "remove (nested ) remarks".
The third time, we get "remove  remarks".
The fourth time, there is no match, and the while terminates.

-- 
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
   -- Charles Williams.  "Judgement at Chelmsford"


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

Date: Sun, 01 Feb 2004 13:27:07 +1100
From: Kieren <holyzarquongod@optusnet.com.au>
Subject: Re: HELP: from XML to mySQL
Message-Id: <87fzdvy1ok.fsf@arthur.zarquon>

"Federico Bari" <fede72bari@tiscali.it> writes:

> PLEASE HELP!
>
> Hi all,
>
>     i need a simple way to import tables saved in a xml document to a mySQL
> databse. I found modules that easily do the opposite process (from mySQL to
> XML), but I don't know how to popolate my mySQL database using datas stored
> in an xml document. Please could somebody give me any suggestion? Thank you,
> from italy

Not perl, but I wouldn't it be best to write some XSL to convert the
XML to SQL?

-- 
Remove god from email addr to reply


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

Date: Sun, 01 Feb 2004 03:03:19 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Historical
Message-Id: <X%ZSb.4755$jH6.1953@newsread1.news.atl.earthlink.net>

"edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
news:18YSb.4653$jH6.1518@newsread1.news.atl.earthlink.net...
> "edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
> news:qkOSb.4022$jH6.3447@newsread1.news.atl.earthlink.net...
>
This is some additional information which should help clarify things.  I
explained parts of this in notes which were posted a few weeks ago.  But it
appears that a review of some of the information might be helpful.

For more than a decade I have been doing a certain type of earthquake
research as a type of very serious hobby.  Much of that research is
discussed at the 90-05.html page at my Web site.

As the research has become more important and more sophisticated is has
required more and more computing power.  I upgraded my computers several
times during the past year and have now reached the absolute limits of what
my computer programs can do with regard to processing data.  So, I need to
switch to a new program or group of programs.  Excel works fairly well as a
spreadsheet program.  But I need a new number crunching and Windows screen
control program.

Perl looks ideal because it has the computing power and versatility, because
it appears to be the most popular program for CGI work, and because anyone
with a fairly powerful computer can download a copy of it and get it
installed with little trouble.  What that means is that I can develop Perl
programs for the applications I am working with and then give them to other
scientists around the world who can also easily get Perl running on their
computers.  Not only will they then be able to generate the same type of
data I am working with.  But they will be able to get into the programs
themselves and modify them if they wish.  However they have to develop at
least some familiarity with the instructions etc. which Perl uses.  And that
is one of the main reasons I stored that Perl.html Web page at my Web site.
It tells them how to open and close files etc.  Additional information will
be added to the Web page.  But with those preliminary instructions people
can probably figure out how to do other things such as write subroutines and
do sorts etc.

So, as long as I am having to learn those things I thought that I would
establish that page and make the information that I found to be important
available to other people.

However, more importantly, I myself still need to convert my present
programs to Perl and develop new ones.  And there are still quite a few
things I don't know how to do.  For example, I am used to reading one word
at a time from comma separated lists in a file for some applications and
reading the entire line for other applications.  I now know how to read an
entire line and can then break it into individual words if necessary.  But I
imagine that there must be some read command which will let you do that
automatically.

I suspect that the most difficult thing will be to learn how to get Perl to
accept keystrokes from the computer keyboard and act on them when the key is
pressed instead of waiting for someone to hit the Enter key.  And I need to
learn how to get it to send information to the Windows program as if itself
were the keyboard.  It can then be used as a sophisticated computer
operations program similar to what macros do for many different programs.

So, I have made the decision to switch to Perl myself.  It runs pretty fast,
only takes up some 50 MB of disk space as far as I can see, and when it is
in the sleep mode while waiting for another program to start running it
frees up the processor to do other things instead of keeping it busy looking
for input.

Now I need to start doing some fine tuning regarding to learn how to use it
for those read operations etc.  What will result before too long is a
program which will start running.  Instructions would be fed to it from the
keyboard.  It would automatically open files and extract the needed data, do
some calculations, store the results in a file somewhere and close it, and
the open a Windows text file window where the data would be displayed.  They
would then be reviewed and accepted.  Or another run would begin to see if
better data could be generated.  The last major run took me about 4 days.
Much of the data processing had to be done by hand.  I am expecting those
time delays to get down into the minutes range.

So, there is a lot to do and many questions to ask.  And this newsgroup
looks like a good place to find answers for questions regarding read
commands etc.




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

Date: Sun, 1 Feb 2004 03:45:04 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Historical
Message-Id: <bvhso0$pvj$1@wisteria.csv.warwick.ac.uk>


"edgrsprj" <edgrsprj@ix.netcom.com> wrote:
> But I need a new number crunching

Perl is perfectly good at this: see PDL. However, you will need to
learn how to write Perl *PROPERLY* before you can use it.

If you are talking to scientists, though, you may be better off with
Fortran, since (at least in my experience) a lot of scientists know
Fortran already.

> and Windows screen control program.

Perl is not suited to this. Something like VBScript is probably
better. It is possible to do it, using the Win32:: modules, but it
isn't terribly easy.

>  But with those preliminary instructions people can probably figure
> out how to do other things such as write subroutines and do sorts
> etc.

No, they can't. You give no indication of how someone might go about
this.

> For example, I am used to reading one word at a time from comma
> separated lists in a file for some applications and reading the
> entire line for other applications.  I now know how to read an
> entire line and can then break it into individual words if
> necessary.  But I imagine that there must be some read command which
> will let you do that automatically.

See $/ in perlvar.

> I suspect that the most difficult thing will be to learn how to get Perl to
> accept keystrokes from the computer keyboard and act on them when the key is
> pressed instead of waiting for someone to hit the Enter key.

Term::ReadKey

> And I need to learn how to get it to send information to the Windows
> program as if itself were the keyboard.

If you are talking console-mode programs that accept keyboard input
from stdin, then

   open my $PROG, '-|', 'program', 'argument'
       or die "can't run program: $!";     # happy, Brian? :)

If you are talking GUI programs then it can't be done. Well, not at
all easily, at any rate; and this applies regardless of which language
you use. GUI programs are not designed to be driven by other programs.

> What will result before too long is a program which will start
> running.  Instructions would be fed to it from the keyboard.  It
> would automatically open files and extract the needed data, do some
> calculations, store the results in a file somewhere and close it,
> and the open a Windows text file window where the data would be
> displayed.  They would then be reviewed and accepted.

I think that what you need is a Perl program that does all of this:
ie. give up on your idea of using other windows programs. If you want
to display a file for review, use Tk. What would serve your colleagues
best would be an application written in Perl which handles all the
difficult stuff of getting data in, displaying it etc.; but which has
the basic data-processing section as a separate module so that people
with little knowledge of Perl can fiddle with the algorithms without
needing to worry about all the GUI stuff.

Writing something like this *will* *not* *be* *easy*. It requires a
lot of thought be put into its design, especially as it is for use by
people who are not very expert. You will never succeed in writing it
unless you stop trying to teach the world how to use Perl and instead
*learn it yourself*.

Ben

-- 
               We do not stop playing because we grow old; 
                  we grow old because we stop playing.
                            ben@morrow.me.uk


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

Date: Sat, 31 Jan 2004 20:53:11 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Historical
Message-Id: <101ou12lil8cc5f@corp.supernews.com>

edgrsprj wrote:

> What will result before too long is a
> program which will start running.  Instructions would be fed to it from the
> keyboard.

> It would automatically open files and extract the needed data, do
> some calculations, store the results in a file somewhere and close it, and
> the open a Windows text file window where the data would be displayed.

Considering what you want your programs to do, would Visual BASIC be a 
better choice? You already know BASIC syntax, don't you?



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

Date: 1 Feb 2004 04:04:13 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Historical
Message-Id: <bvhtrt$8r4$1@canopus.cc.umanitoba.ca>

In article <X%ZSb.4755$jH6.1953@newsread1.news.atl.earthlink.net>,
edgrsprj <edgrsprj@ix.netcom.com> wrote:
:And there are still quite a few
:things I don't know how to do.  For example, I am used to reading one word
:at a time from comma separated lists in a file for some applications and
:reading the entire line for other applications.  I now know how to read an
:entire line and can then break it into individual words if necessary.  But I
:imagine that there must be some read command which will let you do that
:automatically.

You can set $/ to ',' to treat comma as the line terminator (but it
then won't treat newline as a line terminator.)

:I suspect that the most difficult thing will be to learn how to get Perl to
:accept keystrokes from the computer keyboard and act on them when the key is
:pressed instead of waiting for someone to hit the Enter key.

Please look at www.cpan.org at the modules Term::InKey and Term::ReadKey

-- 
Positrons can be described as electrons traveling backwards in time.
Certainly many Usenet arguments about the past become clearer when they
are re-interpreted as uncertainty about the future.
   -- Walter Roberson


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

Date: Sat, 31 Jan 2004 22:09:28 -0600
From: "Dave Hafner" <DHxxxx@inette.com>
Subject: Newbie question.  Get list of files in subdir.
Message-Id: <pan.2004.02.01.04.09.27.199380@inette.com>

How do I read in a list of all the files in a subdirectory?

I just want to build a list of the .wav files that are in a folder so that
I can feed them to an encoder.  This should be very simple - so simple
that I am obviously overlooking the obvious. However, I have learned a ton
of stuff trying, for sure:)

Thanks
DH


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

Date: 1 Feb 2004 04:24:12 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Newbie question.  Get list of files in subdir.
Message-Id: <bvhv1c$99i$1@canopus.cc.umanitoba.ca>

In article <pan.2004.02.01.04.09.27.199380@inette.com>,
Dave Hafner <DHxxxx@inette.com> wrote:
:How do I read in a list of all the files in a subdirectory?

This was gone through not more than 3 days ago.


:I just want to build a list of the .wav files that are in a folder so that
:I can feed them to an encoder.  This should be very simple - so simple
:that I am obviously overlooking the obvious. However, I have learned a ton
:of stuff trying, for sure:)

Quick way:
  use glob().

More controlled way:
  opendir() the directory, loop readdir() a filename, match to see
  if it's one you want. If you use this approach, remember that
  readdir() only returns the filename itself without any directory
  information, so to pass it to something else, you may need to
  prepend the directory name.
-- 
   History is a pile of debris               -- Laurie Anderson


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

Date: Sun, 01 Feb 2004 04:25:32 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Newbie question.  Get list of files in subdir.
Message-Id: <0d%Sb.9304$9a4.8737@nwrddc01.gnilink.net>

Dave Hafner wrote:
> How do I read in a list of all the files in a subdirectory?

perldoc -f opendir
perldoc -f readdir
perldoc -f glob
perldoc File::Find

jue




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

Date: Sat, 31 Jan 2004 20:45:54 -0800
From: Steve May <drumspoorly@reachone.net>
Subject: Re: Newbie question.  Get list of files in subdir.
Message-Id: <101p0s1avpodee3@corp.supernews.com>

Dave Hafner wrote:
> How do I read in a list of all the files in a subdirectory?
> 
> I just want to build a list of the .wav files that are in a folder so that
> I can feed them to an encoder.  This should be very simple - so simple
> that I am obviously overlooking the obvious. However, I have learned a ton
> of stuff trying, for sure:)
> 
> Thanks
> DH

Messing around and trying things is good.

Documentation is even better sometimes. :-)

See opendir, readdir, and grep for more information
on what is going on below.


my $dir = '/path/to/directory';

opendir DIR, $dir or die "Can't open directory $dir: $!\n";
  my @wavfiles = sort grep(/\.wav$/, readdir(DIR));
closedir DIR;

for( @wavfiles ){ print "$_\n"; }



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

Date: 31 Jan 2004 23:21:47 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Perl For Amateur Computer Programmers
Message-Id: <bvhdab$cg4$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Tad McClellan:

> edgrsprj <edgrsprj@ix.netcom.com> wrote:
> 
>> Unfortunately I have been encountering one major problem with
>> it.  And that is with its documentation.
> 
>> Perl's structure which I myself do not yet fully understand.  So what I have
>> been doing while I have been learning how to use it 
> 
> 
> You do not fully understand it and are just learning it, yet _you_
> are qualified to instruct others in how to use it?
> 
> That is ludicrous.

[...]

Now that each and every regular in this group has kicked the OP at least
once, I think it is time to move on to something new. It was somewhat
foreseeable that this thread would become rather repetitive in its
nature. And yet I am surprised that so many people felt inclined to say
the same things over and over again.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sat, 31 Jan 2004 18:54:40 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perl For Amateur Computer Programmers
Message-Id: <pan.2004.01.31.23.54.20.378020@remove.adelphia.net>

On Sat, 31 Jan 2004 16:49:25 +0000, edgrsprj wrote:

> "Ben Morrow" <usenet@morrow.me.uk> wrote in message
> news:bvgi66$miu$1@wisteria.csv.warwick.ac.uk...
> 
>> I do not wish to sound scathing, as I think that what you are trying
>> to do is laudable; but that page is *very* *very* bad. Please take it
> 
> This is the purpose of that Web page:

<snip>

There has already been one person posting to this group with the
suggestion that there was a need for yet another Perl web site.  I suggest
you read the postings they got.  You *will* get about the same response.
Including the list of other Perl sites that are out there that offer solid
advise and direction on using Perl.  You're re-inventing the wheel.

Please, for the love of everything, just try to learn the language first. 

Sorry, but .....
*plonk*

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
If all else fails, immortality can always be assured by
spectacular error.   -- John Kenneth Galbraith 



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

Date: Sat, 31 Jan 2004 18:47:42 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Perl For Amateur Computer Programmers
Message-Id: <t8XSb.7838$qU3.741637@news20.bellglobal.com>


"Tim Hammerquist" <tim@vegeta.ath.cx> wrote in message
news:slrnc1o5ep.73q.tim@kimari.saiyix...
> Matt Garrish <matthew.garrish@sympatico.ca> wrote:
> [...]
> > > downloaded was about 12 million bytes in size (12 Meg).
> >
> [...]
> >  btw: Mb is the proper abbreviation, not Meg...
>
> %abbrev = (
>     MB => 'megabytes',
>     Mb => 'megabits',
> );
>

I stand rightly corrected on that slip up...

Matt




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

Date: Sat, 31 Jan 2004 18:53:19 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Perl For Amateur Computer Programmers
Message-Id: <KdXSb.7842$qU3.742008@news20.bellglobal.com>


"Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote in message
news:bvhdab$cg4$1@nets3.rz.RWTH-Aachen.DE...
>
> Now that each and every regular in this group has kicked the OP at least
> once, I think it is time to move on to something new.
>

True enough, but it's also become a disturbing trend lately. (the Web sites,
that is : )

Best to beat the beast down...

Matt




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

Date: Sun,  1 Feb 2004 01:37:10 +0100 (CET)
From: starwars <nobody@tatooine.homelinux.net>
Subject: print matching elements of a list
Message-Id: <d7f4b71b2d93f415589ece825b22bafd@tatooine.homelinux.net>

I want to print x, if a $var matches any of the elements of a list.

How do I write that?

I am not any kind of a programmer, but am trying to just get some very basic
stuff done on my linux box.

Thx.



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

Date: 1 Feb 2004 00:51:56 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: print matching elements of a list
Message-Id: <bvhijc$41o$1@canopus.cc.umanitoba.ca>

In article <d7f4b71b2d93f415589ece825b22bafd@tatooine.homelinux.net>,
starwars  <nobody@tatooine.homelinux.net> wrote:
:I want to print x, if a $var matches any of the elements of a list.

:How do I write that?

Is that matches as in a regular expression, or is that matches
as in equality?

If it is regular expressions, then

perldoc -q "How do I efficiently match many regular expressions at once?"
to get the answer from the perl faq.

If it is equality, then

perldoc -q "How can I tell whether a certain element is contained in a list or array?

for a discussion of several techniques from the perl faq.
-- 
Contents: 100% recycled post-consumer statements.


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

Date: Sat, 31 Jan 2004 18:08:23 -0700
From: Bill <wherrera@lynxview.com>
Subject: Re: print matching elements of a list
Message-Id: <ecGdnaFuY-gVzIHd4p2dnA@adelphia.com>

starwars wrote:
> I want to print x, if a $var matches any of the elements of a list.
> 
> How do I write that?
> 
> I am not any kind of a programmer, but am trying to just get some very basic
> stuff done on my linux box.
> 
> Thx.
> 

Uses builtin grep function, assumes you want to find ALL matches:

my @matched = grep { $var eq $_ } @list;
print 'x' if scalar @matched;

More efficient if the match is early in @list:

foreach (@list) { if ($var eq $_} { print 'x'; last } }





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

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


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