Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: Comparing f...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 11 Topic 11016 of 11509
Post > Topic >>

Re: Comparing files with regular expressions

by chas.owens@[EMAIL PROTECTED] (Chas. Owens) May 2, 2008 at 07:56 PM

On Fri, May 2, 2008 at 10:44 AM, rubinsta <rubinsztajn@[EMAIL PROTECTED]
> wrote:
snip
> Any thoughts as to why
>  some of the matches are getting missed?
snip

Not off hand.  I will extract your code and do some tests.  Can you
send me your data or is it sensitive?

snip
>  Just out of beginner curiosity, why did you suggest I use the 3
>  argument filehandle instead of:
>  open(EX, "exclude1.txt") or die $!
snip

Because the three argument version of open is safer.  It doesn't
matter in the code you wrote because you used a literal string, but if
you say

open FH, $file or die "could not open $file: $!";

expecting FH to be a read filehandle and $file contains the filename
">im****tant", you will wind up with a write filehandle.  Specifying
the type of filehandle you want separately from the file is an
im****tant safety feature.  Using the old version of open is a bad
habit you should not develop.  You should know it exists (like many of
the other bad habits left over from earlier versions of the Language)
in case you run into code that uses it, but you shouldn't use it
yourself.  I would also strongly recommend using lexical filehandles
instead of the old bareword style for similar reasons.

-- 
Chas. Owens
wonkden.net
The most im****tant skill a programmer can have is the ability to read.
 




 11 Posts in Topic:
Comparing files with regular expressions
rubinsztajn@[EMAIL PROTEC  2008-05-01 13:09:53 
Re: Comparing files with regular expressions
chas.owens@[EMAIL PROTECT  2008-05-02 07:41:47 
Re: Comparing files with regular expressions
rubinsztajn@[EMAIL PROTEC  2008-05-02 07:44:57 
Re: Comparing files with regular expressions
chas.owens@[EMAIL PROTECT  2008-05-02 19:56:47 
Re: Comparing files with regular expressions
Jenda@[EMAIL PROTECTED]   2008-05-03 22:42:10 
Re: Comparing files with regular expressions
chas.owens@[EMAIL PROTECT  2008-05-03 17:01:53 
Re: Comparing files with regular expressions
Jenda@[EMAIL PROTECTED]   2008-05-03 23:57:06 
Re: Comparing files with regular expressions
rob.dixon@[EMAIL PROTECTE  2008-05-04 01:08:19 
Re: Comparing files with regular expressions
chas.owens@[EMAIL PROTECT  2008-05-03 21:40:34 
Re: Comparing files with regular expressions
rubinsztajn@[EMAIL PROTEC  2008-05-05 09:28:52 
Re: Comparing files with regular expressions
rob.dixon@[EMAIL PROTECTE  2008-05-05 15:24:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 23 21:07:55 CDT 2008.