Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Jim Bauer
On Thu, 11 Aug 2011 16:17:51 -0700, siegfr...@heintze.com wrote: This works! Is there a way to do it with less typing? How can I do it without creating a temporary variable @p? rename($_, sprintf(./%s.txt, (split '/')[-1])); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: Determining current function name

2010-12-30 Thread Jim Bauer
On Thu, 30 Dec 2010 18:30:04 -0800, Parag Kalra wrote: Hi, Just like $0 reveals the current script name is there any variable using which I can find the current sub-routine I am currently in. printf(currently in %s\n, (caller(0))[3] =~ /^.+:(\w+)$/); See `perldoc -f caller'. ---

Re: match pattern

2009-09-18 Thread Jim Bauer
raphael() raphael.j...@gmail.com wrote on Fri, 18 Sep 2009 22:10:01 +0530: Hi How do I pick out matching words if there are more than one on the same line? Example INFILE.TXT www.site01.com www.site02.com www.site03.com www.site04.com -- while () { if ( m!(www.\S+.com)!s ) { Try

Re: matching multi occurrences or nothing

2009-09-17 Thread Jim Bauer
Noah Garrett Wallach noah-l...@enabled.com wrote on Thu, 17 Sep 2009 13:23:37 -0700 Hi there Perl folks, Okay I am trying to figure this out. I am trying to match the following: $line = blahblahblah so I have the following line to match that $line =~ /((?:blah).*?){0,5}/; But I want to