Re: File checks

2014-05-22 Thread Manfred Lotz
On Thu, 22 May 2014 16:51:24 -0500 Andy Bach wrote: ... Very interesting experiments. > $ perl -e '$fname = "st"; print "yes\n" if ( -f $fname and not -l > _ )' > The stat preceding -l _ wasn't an lstat at -e line 1. This tells me that if ( -f $fname and not -l _ )' should perhap

Re: File checks

2014-05-22 Thread Manfred Lotz
On Thu, 22 May 2014 14:37:01 -0700 Charles DeRykus wrote: > On Thu, May 22, 2014 at 1:40 PM, Manfred Lotz > wrote: > > Hi there, > > I want to check if a file is a plain file but not a symlink. > > > > It seems because -f returns true for a symlink that I have to do > > this: my $fname = 'somefi

Re: File checks

2014-05-22 Thread Uri Guttman
On 05/22/2014 05:51 PM, Andy Bach wrote: On Thu, May 22, 2014 at 4:37 PM, Charles DeRykus wrote: I was just fiddliing w/ that too and, creating a sym link behaves different than a hard link but: as you should know those are very different animals $ ln nohup.out st $ perl -e '$fname = "st

Re: File checks

2014-05-22 Thread Andy Bach
On Thu, May 22, 2014 at 4:37 PM, Charles DeRykus wrote: > Potentially shorter and arguably simpler if you use the special > underscore argument to access file info for previous test, eg, > >if ( -f $fname and not -l _ ) { >say... >} > I was just fiddliing w/ that too and, cre

Re: File checks

2014-05-22 Thread Charles DeRykus
On Thu, May 22, 2014 at 1:40 PM, Manfred Lotz wrote: > Hi there, > I want to check if a file is a plain file but not a symlink. > > It seems because -f returns true for a symlink that I have to do this: > my $fname = 'somefile'; > > if ( -f $fname and not -l $fname ) { > say "$fname is a

File checks

2014-05-22 Thread Manfred Lotz
Hi there, I want to check if a file is a plain file but not a symlink. It seems because -f returns true for a symlink that I have to do this: my $fname = 'somefile'; if ( -f $fname and not -l $fname ) { say "$fname is a plain file"; } Is there a simpler way to do this? -- Manfred

Re: How to parse C#, javascript, lisp source code for quoted literal strings

2014-05-22 Thread Jim Gibson
On May 22, 2014, at 2:04 AM, wrote: > I need to extract some information from source code. > > How can I write a perl regular expression that will match a literal string in > languages like C#, javascript, java and lisp? > > Here is my naive approach: > > /"[^"]*"/ > > This of course does

Re: How to parse C#, javascript, lisp source code for quoted literal strings

2014-05-22 Thread Rob Dixon
On 22/05/2014 10:04, siegfr...@heintze.com wrote: I need to extract some information from source code. How can I write a perl regular expression that will match a literal string in languages like C#, javascript, java and lisp? Here is my naive approach: /"[^"]*"/ This of course does not accom

Re: How to parse C#, javascript, lisp source code for quoted literal strings

2014-05-22 Thread Jing Yu
On 22 May 2014, at 10:04, siegfr...@heintze.com wrote: > I need to extract some information from source code. > > How can I write a perl regular expression that will match a literal string in > languages like C#, javascript, java and lisp? > > Here is my naive approach: > > /"[^"]*"/ > > Thi

How to parse C#, javascript, lisp source code for quoted literal strings

2014-05-22 Thread siegfried
I need to extract some information from source code.How can I write a perl regular _expression_ that will match a literal string in languages like C#, _javascript_, java and lisp?Here is my naive approach:/"[^"]*"/This of course does not accommodate backslashes in the string that perl, C, C# _javas

Re: autoflush $| .. practical use of this

2014-05-22 Thread Shlomi Fish
Hi Agnello, On Thu, 22 May 2014 11:43:46 +0530 Agnello George wrote: > Hi > > I just came across this special var $| , autoflush , jsut wondering how and > where to use this . Can some one help me understand the concrete use of > this special var. > First of all, you should not use "$|" direc