[11712] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5312 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 6 16:27:28 1999

Date: Tue, 6 Apr 99 13:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 6 Apr 1999     Volume: 8 Number: 5312

Today's topics:
    Re: (newbie) matching value from array??? <gellyfish@gellyfish.com>
        absolute path to the running script? <dhenders@cpsgroup.com>
    Re: absolute path to the running script? <jdf@pobox.com>
    Re: an IDE for perl program developing <ddelikat@protix.com>
    Re: Anyone help with reading from data file?  Read here <aqumsieh@matrox.com>
    Re: Anyone help with reading from data file?  Read here <cassell@mail.cor.epa.gov>
    Re: CGI.pm - Doesn't recognize consecutive white spaces (Tad McClellan)
    Re: chmod - setting permissions with perl? <greg.wimpey@waii*removetomail*.com>
    Re: chmod - setting permissions with perl? <aqumsieh@matrox.com>
    Re: chmod - setting permissions with perl? (Abigail)
    Re: chmod - setting permissions with perl? (Tad McClellan)
    Re: Elegant parsing of HTML title and metatags? <cassell@mail.cor.epa.gov>
    Re: How to "my" a file handle <aqumsieh@matrox.com>
    Re: How to check for benchmark speed of a program? <aqumsieh@matrox.com>
    Re: How to handle a ctrl-C interupt ? <aqumsieh@matrox.com>
    Re: How to handle a ctrl-C interupt ? (Abigail)
    Re: How to prevent Ctrl-C from <STDIN>? <aqumsieh@matrox.com>
    Re: How to prevent Ctrl-C from <STDIN>? (Abigail)
    Re: I can't use alarm :( <cassell@mail.cor.epa.gov>
    Re: leap year? <cassell@mail.cor.epa.gov>
    Re: leap year? (Abigail)
    Re: Problems connecting to Oracle 8 from Perl using DBI (Jed Parsons)
    Re: Recursion in Perl <ddelikat@protix.com>
    Re: Recursion in Perl <naik@omsi.com>
    Re: Recursion in Perl (Greg Bacon)
    Re: Regexp question <aqumsieh@matrox.com>
    Re: Regexp question <aqumsieh@matrox.com>
        Regular Expression kelly_d@my-dejanews.com
    Re: Regular Expression <jdf@pobox.com>
        running outside program from perl script <sjfox@email.sjsu.edu>
    Re: Urgent: Document contains no data <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 5 Apr 1999 13:08:54 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: (newbie) matching value from array???
Message-Id: <7eacl6$19s$1@gellyfish.btinternet.com>

On Mon, 05 Apr 1999 04:49:54 GMT Jerry wrote:
> Let me try explaining again what I'm trying to do.  I have a table in
> a MySQL database that has in it a list of scores and game related info
> from a little league, including the name of each team (home team and
> away team are listed as such) and the scores, times, etc...  so I can
> print weekly schedules and results.
> 
> In another table, I have a list of the teams in the league and for
> each team I have the manager's name, the city name and the url for
> each team's web site (but only if they have one). This way I don't
> have to repeat all the info in the scores table for each team.  
> 
> Now I'm trying to figure out how to link to the team's web site (but
> only if they have one because not all of the team's do) when I print
> out the scores.  And obviously sometimes the team is listed under home
> team and sometimes under away team. The team name in the schedule will
> always match a team in the team table.
> 
> I have the sql query pulling the scores and printing last week's
> results just fine.  Now, I figure I need to do a separate query before
> I pull the results, that lists the team and url pairs so that I can
> match them up against the home team and away team when I loop through
> the schedule/results table and then print a link to the team's web
> site whenever I print the team's name in the weekly results.
> 
> Does that make a little more sense?
> 

Only marginally and it is also really only marginally Perl related 
it is more to do with your databas design and your understanding of SQL.

The way that I would do this (assuming you cant change the database schema)
is as one query which joins the results table to the team details table:

SELECT results.*,home.*,away.*
FROM results, teams home,teams away
WHERE results.home_team_name = home.short_name AND
      results.away_team_name = away.short_name

I have no idea what your table or column names are so I made them up.

It does of course presuppose that your DB supports table aliases.

The advantage here is that you only have one query returning one dataset.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 06 Apr 1999 13:40:05 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: absolute path to the running script?
Message-Id: <87bth1twxm.fsf@camel.cpsgroup.com>



I'm trying (unsucessfully) to find the absolute pathname within a
running script $0 contains the name the script was called as
(e.g. ./foo perl/foo etc).

Is there any way to easily retrieve the absolute pathname in a running
process? 

-- 
Dale Henderson <mailto:dhenders@cpsgroup.com> 

"Imaginary universes are so much more beautiful than this stupidly-
constructed 'real' one..."  -- G. H. Hardy


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

Date: 06 Apr 1999 14:53:08 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: absolute path to the running script?
Message-Id: <m31zhxinsb.fsf@joshua.panix.com>

Dale Henderson <dhenders@cpsgroup.com> writes:

> Is there any way to easily retrieve the absolute pathname in a
> running process?

  perldoc FindBin

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 06 Apr 1999 14:03:05 -0500
From: David Delikat <ddelikat@protix.com>
Subject: Re: an IDE for perl program developing
Message-Id: <370A5A69.1CFB@protix.com>

David L. Cassell wrote:
> 
>   Perl doesn't have the
> write-compile-link-curse-debug cycle of C, so some of the
> features of an IDE aren't needed.
> 

I occasionally have to convince people(bosses) that perl is
a good resource, and I was wondering if I could quote you.

-dav

-- 
<((((><
Consultant: Internet, Database, Business Systems
Unix/Linux, Windows95/NT
mailto:david-delikat@usa.net / http://obj.webjump.com/


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

Date: Tue, 6 Apr 1999 15:03:22 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Anyone help with reading from data file?  Read here.
Message-Id: <x3yd81ho9l3.fsf@tigre.matrox.com>


"Freaky" <D@nt.Email.Me> writes:

> Does anyone know how to read a data file in reverse order? I use the format
> open (HEADERREAD, "$file3") or die "Unable to open...
> and it will only read in normal order.  Im just curious if theres a way to
> reverse it.  Thanks.

What do you mean by "reverse order"? Last line first? Last byte first?
Last word first?

perldoc -f reverse



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

Date: Tue, 06 Apr 1999 12:28:37 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Anyone help with reading from data file?  Read here.
Message-Id: <370A6065.4B1BE722@mail.cor.epa.gov>

Freaky wrote:
> 
> Does anyone know how to read a data file in reverse order? I use the format
> open (HEADERREAD, "$file3") or die "Unable to open...
> and it will only read in normal order.  Im just curious if theres a way to
> reverse it.  Thanks.
> 

Do you mean "How do I do a 'tail -f' in Perl?" [that's what it's
called in the unix world]
It's covered in perlfaq5.  Or just type 'perldoc -q tail' in a
command window.

This may be a case where the FA_Question is frequently asked
in a format too different for many users to find.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 6 Apr 1999 10:44:46 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: CGI.pm - Doesn't recognize consecutive white spaces
Message-Id: <uk6de7.8h1.ln@magna.metronet.com>

I R A Aggie (fl_aggie@thepentagon.com) wrote:
: On Tue, 06 Apr 1999 07:24:35 GMT, rajesh_bhave@my-dejanews.com
: <rajesh_bhave@my-dejanews.com> wrote:

: + CGI.pm doesn't recognize consecutive white spaces; this is why I don't get
: + consecutive spaces on the HTML generated by the CGI script. Any way to get
: + these spaces in HTML. Your help is highly appreciated.

: Have you done a 'view source'? did you know that HTML renderers don't
: observe whitespace, and require a "special character" to force that
: behaviour on them? do you know what that tag is?


   And do you know that it is not a tag at all?

   Tags are from '<' to '>'.

   Elements are from <starttag> to </endtag>.

   "Entity" is the word for the representation of a &nONbREAKINGspACE;


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 06 Apr 1999 13:01:57 -0600
From: Greg Wimpey <greg.wimpey@waii*removetomail*.com>
Subject: Re: chmod - setting permissions with perl?
Message-Id: <snd81ho9ne.fsf@ddcspn37.denver.waii.com>

Tom Kralidis <tom.kralidis@ccrsDotnrcandOtgc.ca> writes:

> You can try 
> 
> system("chmod 755 ../test/jpg");
> 
> File permissions, AFAIK, are 3 digits (owner, group, public)
> 

Actually, file permissions should be specified in octal notation,
which traditionally indicated by a leading 0 (much like '0x' indicates
hex notation).  Most (all?) implementations of the Unix 'chmod'
command assume octal notation, so your example will work.  The perl
chmod() function, like its Unix system call equivalent, just takes an
integer as the numerical mode, so leaving off the leading '0' will
cause the mode to be interpreted as a decimal number rather than
octal.  This is not good.  See the 'perlfunc' manpage for more
information.

-- 
Greg Wimpey
greg.wimpey@waii*removetomail*.com


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

Date: Tue, 6 Apr 1999 14:22:59 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: chmod - setting permissions with perl?
Message-Id: <x3yhfqtobgc.fsf@tigre.matrox.com>


Tom Kralidis <tom.kralidis@ccrsDotnrcandOtgc.ca> writes:

> File permissions, AFAIK, are 3 digits (owner, group, public)

>From 'perldoc -f chmod':

                                             The first element of the
list must be the numerical mode, which should probably be an octal
number, and which definitely should I<not> a string of octal digits:
C<0644> is okay, C<'0644'> is not.



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

Date: 6 Apr 1999 19:26:13 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: chmod - setting permissions with perl?
Message-Id: <7edn4l$jgp$1@client2.news.psi.net>

Tim Lotz (tim@pixelfilm.de) wrote on MMXLIV September MCMXCIII in
<URL:news:370A2B11.C835ACFD@pixelfilm.de>:
// hi,
// 
// i'm trying to change the permissions from a file in my www-directory
// from 0600 to 0755.
// i tired the following script (plus thousand different scripts):
// 
// chmod(0755, '../test.jpg');
// print "done";
// 
// it doesn't work.
// does anybody knows why?

Yes, Perl *KNOWS*. Check the return value and do something smart if
the chmod fails. Just like you do for any systems function.

// my book says, that this is the way to do it. does it lie:)?

Yes.



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


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

Date: Tue, 6 Apr 1999 07:31:47 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: chmod - setting permissions with perl?
Message-Id: <3brce7.dc1.ln@magna.metronet.com>

Tim Lotz (tim@pixelfilm.de) wrote:

: i'm trying to change the permissions from a file in my www-directory
: from 0600 to 0755.

: chmod(0755, '../test.jpg');
: print "done";

: it doesn't work.
: does anybody knows why?


   Perl (and the OS) probably knows why.

   Ask them to tell you:

      chmod(0755, '../test.jpg') || die "could not chmod()   $!";
                                                             ^^
                                                             ^^
   Then have a look in your server logs (or wherever STDERR goes
   in your environment)


: my book says, that this is the way to do it. does it lie:)?


   If it lets you omit checking the return values from calls
   that talk to the OS, then it is profoundly sub-optimal.


   What book is it?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 06 Apr 1999 12:19:29 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Elegant parsing of HTML title and metatags?
Message-Id: <370A5E41.ACB5BC88@mail.cor.epa.gov>

Neale Morison wrote:
> 
> I'd appreciate any help. I'm new to regexs and I'm looking for the most
> elegant and efficient syntax.

If you want the most *elegant* solution, then get the HTML::Parser
module and let it do all the dirty work for you.  Extremely
elegant.

> I'm trying to parse out the title and metatags from an HTML file.
> The following is my partial solution but it has serious flaws:
> - it's inelegant - for example, I don't think I should have to
> explicitly set $_ and use an if statement with the match.

Right.  Read up on the pattern-binding operator [it's =~ ] 
if you want to match some named variable.  If you want to match
against $_ then you can just say:
  m/PATTERN/;
and Perl automatically matches againt $_ without further
fiddling.

> - it doesn't work - it only extracts the last metatag, and I want to get
> them all

That's a serious problem.  Using an already-written module
would solve that.

> - it may be memory inefficient and slow for large files - do I have to
> read the whole file into memory, or is there a cute way of doing this
> reading line by line?

You can do this line by line, but what happens when someone
has a tag that runs over multiple lines?  Anyway, unless the file
is nearly as large as your available RAM, I don't see that this is
a big problem.

> - I have heard that using $1 and $2 has an overhead and ideally I'd like
> to avoid that

True.  But that's due to the need for your backreferences to update
$1 and $2 each time the regex has to backtrack.  If you want to
capture text, you have to do this, either implicitly or
explicitly.  However, $1 and $2 are not as expensive as $` or $&
or $' .
 
> $filename = "test1.html";
> open FILE, $filename ;

You ought to check for errors on your open() .

> local $pagetext;
> local $metatags;

Don't use local().  Use my().
 
> while (<FILE>) { $pagetext .= $_ }

This would work if you wanted all lines in separate elements
of the array:
@pagetext = <FILE>; 
But you don't really want that.  You really want to read up
on $/ so you can slurp the whole file in.

> close FILE;

Good that you're closing FILE here, but you ought to
check for errors on the close() too.  Just in case.

> $_ = $pagetext;
> if (m{.*<TITLE>(.*)</TITLE>.*}si) { # parse out the title

Good that you're using {} instead of // here.  But...
(1) a foreach loop would let you go line by line.
(2) $var =~ m{PATTERN} is the way to match against $var.
(3) /s doesn't help you here.
(4) you need to be going over multiple lines to get all
    tags.
(5) .* is GREEDY.  It eats everything that it can.  You
    need the non-greedy version .*? instead.

>  $title = $1;
>  $title =~ s/\n//;
> }
> if (m{^.*<META NAME\s*=\s*\"(.*)\"\s*CONTENT\s*=\s*\"(.*)\"\s*>.*$}si) {

See above, and also:
(6) " is not a special character.  you don't need to backwhack it.

> # parse out the metatags
>  $metatags{$1} = $2;
> }
> 
> print $title;
> while(($key,$val) = each(%metatags))
> {
>  print "$key: $val\n";
> }

What happens when there's a double quote in the tag?  Or some
extra < or > symbols?  Your regex won't work right.  This is
harder than it looks to get exactly right.

Try using HTML::Parser to do all this.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 6 Apr 1999 13:30:34 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to "my" a file handle
Message-Id: <x3yn20lodvq.fsf@tigre.matrox.com>


"Pedro Garrett" <pedrogarrett@mediaone.net> writes:

> I read the FAQ on how to "local" a file handle, but how do I "my" one?  Or
> is there maybe no reason to do this?

IMO, Filehandles should've had a standard prefix like the other data
types ('$' for scalars; '@' for arrays; '%' for hashes). If FHs did
have such a prefix (maybe a '^' ?), then you would have been able to
declare them via my().

Currently, you need to use a typeglob assignment. By definition,
typeglobs HAVE to reside in the symbol table. local() variables do
reside in the symbol table as well, so you can local()ize
typeglobs. OTOH, my() variables do not reside in the symbol
table. They are simply placed in an array that is associated with a
certain scope. Thus, you can't use my() on typeglobs. For more info,
checkout perlfaq7:

	What's the difference between dynamic and lexical (static)
	scoping?  Between local() and my()? 

Note however that there IS a way to create lexical filehandles. Use
the FileHandle.pm standard module.

HTH,
Ala



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

Date: Tue, 6 Apr 1999 14:02:01 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to check for benchmark speed of a program?
Message-Id: <x3ylng5ocfa.fsf@tigre.matrox.com>


agniora@usa.net writes:

> If i want to check how long it takes to do a certain task for a program, how
> can i do it? eg to test the total time taken of the following program :  $_ =
> 'This is a text';  print tr/ //;

perldoc Benchmark



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

Date: Tue, 6 Apr 1999 14:27:07 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to handle a ctrl-C interupt ?
Message-Id: <x3yemlxob9g.fsf@tigre.matrox.com>


Wim Janssen <janssen@caos.kun.nl> writes:

> Lectori Salutem,

er .. yeah .. same to you.

> How do I handle an interupt like ctrl-C in a perl-script.

I just answered that same question (asked by someone else). Basically,
read the entry for %SIG in perlvar, read perlipc, read sigtrap.



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

Date: 6 Apr 1999 19:49:22 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to handle a ctrl-C interupt ?
Message-Id: <7edog2$k4g$1@client2.news.psi.net>

Wim Janssen (janssen@caos.kun.nl) wrote on MMXLIV September MCMXCIII in
<URL:news:370A1B17.C6F1A85F@caos.kun.nl>:
// Lectori Salutem,
// 
// How do I handle an interupt like ctrl-C in a perl-script.


FAQ.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: Tue, 6 Apr 1999 14:25:43 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to prevent Ctrl-C from <STDIN>?
Message-Id: <x3yg16dobbt.fsf@tigre.matrox.com>


Fu Chin Liu <fuchin@mail.nwos.lucent.com> writes:

> Hi, how can we prevent users from using CTRL-C to quit perl program when
> it is
> waiting for users' input from <STDIN>?

1) Read the documentation on the special %SIG hash in 'perlvar'
2) Read 'perldoc perlipc'
3) Read 'perldoc sigtrap'

HTH,
Ala



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

Date: 6 Apr 1999 19:49:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to prevent Ctrl-C from <STDIN>?
Message-Id: <7edogo$k4g$2@client2.news.psi.net>

Fu Chin Liu (fuchin@mail.nwos.lucent.com) wrote on MMXLIV September
MCMXCIII in <URL:news:370A1895.FC7F74E5@mail.nwos.lucent.com>:
## Hi, how can we prevent users from using CTRL-C to quit perl program when
## it is
## waiting for users' input from <STDIN>?


FAQ.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Tue, 06 Apr 1999 12:00:49 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: I can't use alarm :(
Message-Id: <370A59E1.9DF9267A@mail.cor.epa.gov>

Fernando Ariel Gont wrote:
> 
> Hola All , llego la alegria!! :D
> 
> I wanted to use alarm to timeout a function. I tried to make a little
> script to "test" it, but I got an error message... :(
> 
> Here's the script:
> 
> /* (ALARM.PL)
> #! /local/bin/perl
> 
> use strict;
> 
> $SIG{'ALRM'}= \&mi_alarma;
> alarm(10);
> 
> sub mi_alarma{
>         print "Recibm una se1al de alarma!\n";
> }
>         */
> 
> And here's the error message I got:
> 
> The Unsupported function alarm function is unimplemented at alarm.pl line 6.
> 
> What's wrong?

Probably the fact that you're trying to use alarm() on a win32
box.  Read the perl-win32 FAQ and it will tell you that (among
other useful functions like fork() ) alarm() is one of the
unimplemented functions in win32 Perl.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 06 Apr 1999 12:47:37 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: leap year?
Message-Id: <370A64D9.D74E83AB@mail.cor.epa.gov>

du_bing@my-dejanews.com wrote:
> 
> Hi there,
> 
> How to judge if the current year is a leap year or not in Perl?  There should
> be a formula.  Unfortunately I forgot.
> 
> Thanks in advance for your help,
> Bing
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


Actually, this is a FAQ.. just not in Perl.  But it's in the
comp.lang.c FAQ if that's any help.

Just check:
year divisble by 4?  then yes
  year divisible by 100?  then no
    year divisible by 400?  then yes

[Note first make sure to add 1900 to the $year variable if it
 is coming from the C struct tm or from localtime() .]
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 6 Apr 1999 19:51:54 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: leap year?
Message-Id: <7edokq$k4g$3@client2.news.psi.net>

du_bing@my-dejanews.com (du_bing@my-dejanews.com) wrote on MMXLIV
September MCMXCIII in <URL:news:7eda79$2vg$1@nnrp1.dejanews.com>:
~~ Hi there,
~~ 
~~ How to judge if the current year is a leap year or not in Perl?  There should
~~ be a formula.  Unfortunately I forgot.


Find someone who was born on February 29 and ask him/her whether she/he
has a birthday this year.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: 6 Apr 1999 19:14:15 GMT
From: jed@socrates.berkeley.edu (Jed Parsons)
Subject: Re: Problems connecting to Oracle 8 from Perl using DBI
Message-Id: <7edme7$gak$1@agate.berkeley.edu>

>$ENV{'ORACLE_HOME'}  = "E:\ORANT";

Isn't that \ going to be treated as an escap character within double quotes?

Jed

-- 
Jed Parsons:                                ``Lingua balbus, hebes ingenio
Harpsichordist, Classicist, Homebrewer.        Viris doctis sermonem facio.''
mailto:jed@socrates.berkeley.edu                             -- Archipoeta
http://www.OCF.Berkeley.EDU/~jparsons/


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

Date: Tue, 06 Apr 1999 13:59:31 -0500
From: David Delikat <ddelikat@protix.com>
Subject: Re: Recursion in Perl
Message-Id: <370A5993.59E2@protix.com>

Sameer G. Naik wrote:
> 
> Hello Friends,
> 
>         Is it possible to have recursion in Perl ?
>         I want to traverse directory tree recursively.
>         Or is there any function which would traverse
>         the given node and return all the filenames
>         ( like C function FTW ) ?
> 
> Thanks,
> Sameer G. Naik.
> naik@omsi.com

HMMM, let me venture a guess...

perldoc recursive

-dav

-- 
<((((><
Consultant: Internet, Database, Business Systems
Unix/Linux, Windows95/NT
mailto:david-delikat@usa.net / http://obj.webjump.com/


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

Date: Tue, 06 Apr 1999 12:12:14 -0700
From: "Sameer G. Naik" <naik@omsi.com>
Subject: Re: Recursion in Perl
Message-Id: <370A5C8E.EE47F4C7@omsi.com>

I made the dir pointer returned by opendir local, as
local *CURRDIR;
Earlier I was using PERL 4.X and it used to give me syntax
error for this line. It works fine with PEL 5.X

-- Sameer.

Sameer G. Naik wrote:
> 
> Hello Friends,
> 
>         Is it possible to have recursion in Perl ?
>         I want to traverse directory tree recursively.
>         Or is there any function which would traverse
>         the given node and return all the filenames
>         ( like C function FTW ) ?
> 
> Thanks,
> Sameer G. Naik.
> naik@omsi.com


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

Date: 6 Apr 1999 19:58:20 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Recursion in Perl
Message-Id: <7edp0s$5ge$1@info2.uah.edu>

In article <370A50A4.B858BD4C@omsi.com>,
	"Sameer G. Naik" <naik@omsi.com> writes:
: 	Is it possible to have recursion in Perl ?

Yes.

: 	I want to traverse directory tree recursively.
: 	Or is there any function which would traverse
: 	the given node and return all the filenames
: 	( like C function FTW ) ?

You might want to look into using the File::Find module (that comes with
Perl) for doing this.

Greg
-- 
Artifical insemination is when the farmer does it to the cow instead of the
bull. 
    -- Funny Answers to Science Test Questions


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

Date: Tue, 6 Apr 1999 14:17:11 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Regexp question
Message-Id: <x3yk8vpobq0.fsf@tigre.matrox.com>


Brian Rectanus <brectanu@vt.edu> writes:

> #!/usr/bin/perl

IMO, even when you are replying to a simple question, you should
enforce good programming habits. Using '-w' is one of them.

> $line1 = '@@Some sentence here.@@'; # No whitespace before/after
> $line2 = '   @@Some sentence here.@@  '; # Some whitespace before/after
> $line3 = ' blah @@Some sentence here.@@ blah '; # Anything before/after
> 
> # Get rid of the @@'s
> $line1 =~ s/^@@(.*)@\@$/$1/;
> $line2 =~ s/^\s*@@(.*)@@\s*$/$1/;
> $line3 =~ s/^.*@@(.*)@@.*$/$1/;

Of course, you can use the last regexp for all three of them. But what
if there is a \n character between the starting @@ and ending @@? Your
matching is also greedy.

> print "'$line1'\n";
> print "'$line2'\n";
> print "'$line3'\n";
> 
> Here is a simple way of doing it.  It will not work if there are
> multiple sentences in a string (ie -- '@@Sentence 1.@@ @@Sentence 2.@@')
> That is left as an exercise for the user :)

Here's something that'll work for multiple sentences, and possible
embedded newline characters:

@sentences = $string =~ /@@(.*?)@@/gs;

HTH,
Ala



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

Date: Tue, 6 Apr 1999 14:19:29 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Regexp question
Message-Id: <x3yiub9obm6.fsf@tigre.matrox.com>


"B. Zimmerman" <zim@ou.edu> writes:

> Am I missing something about this question?
> 
> #!/usr/bin/perl -w
> 
> while (<>) {
> 	if (/\x40\x40(.*)\x40\x40/) {
> 		push @vals,$1;
> 	}
> }
> 
> will this not do the job?

Not if there are embedded newlines.
Not if there are multiple sentences in the string.



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

Date: Tue, 06 Apr 1999 19:02:29 GMT
From: kelly_d@my-dejanews.com
Subject: Regular Expression
Message-Id: <7edlo0$cqf$1@nnrp1.dejanews.com>

Hi,

I am presently writing a Perl program and I am using regular expresssions a
lot. I am relatively new with Perl and so far I have overcome most problems
except of course this one.

I am interested in creating a regular expression for finding words that are in
CAPTIAL letters in any one line.  All I have succeeded in doing is finding 1
captial letter in every line by the use of
/[A-Z]+/ expression.

However to get at least one full word I have to type [A-Z][A-Z] etc.

Can anyone help me in the creation of this R.E.

Thanking you in advance

Kelly

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 06 Apr 1999 14:56:04 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: kelly_d@my-dejanews.com
Subject: Re: Regular Expression
Message-Id: <m3yak5h92z.fsf@joshua.panix.com>

kelly_d@my-dejanews.com writes:

>  All I have succeeded in doing is finding 1 captial letter in every
> line by the use of /[A-Z]+/ expression.

Right, since the + metacharacter means "one or more of the preceding
expression".

> However to get at least one full word I have to type [A-Z][A-Z] etc.

If you mean "two or more", then say so using the quantifier {n,} as
documented in perlre.

  /[A-Z]{2,}/

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 6 Apr 1999 11:58:22 -0700
From: "Stephanie Fox" <sjfox@email.sjsu.edu>
Subject: running outside program from perl script
Message-Id: <7edlo6$21t$1@hades.csu.net>

Hello,

I have this perl script that I want to run from the web that sends an email
using our email software, and then writes some html code back to the web.

Our server that is running this is a Windows NT server running IIS 4.0.

If I run this program from a DOS command line, it works great. The email is
sent fine.

However, if I call it from a web page, the html shows up fine, but the email
message does not get sent, and I can't seem to find any errors anywhere.

Any ideas?




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

Date: Tue, 06 Apr 1999 12:24:06 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Urgent: Document contains no data
Message-Id: <370A5F56.4841BDDC@mail.cor.epa.gov>

Shade L. Jenifer wrote:
> 
> Thanks to everyone who responded.
> 
> It turns out that the perl code was attempting
> to divide by 0....ouch.
>
> > [snip]
> --
> Shade L. Jenifer
> Systems Engineer
> NWS Consulting, Inc.
> 
> Census Bureau: GEO/MSB
> sjenifer@geo.census.gov
> (301) 457-1073

Well, as we say out here in Oregon, "Good enough for government
work..."  :-)

[Note my e-mail address]
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5312
**************************************

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