print map question

2010-11-13 Thread Mike McClain
mike@/deb40a:~/perl perl -v This is perl, v5.8.8 built for i486-linux-gnu-thread-multi mike@/deb40a:~/perl perl -we ' @list=qw/Perl is cool./;print( list=\t, map { $_, } @list, \n); ' list= Perl,is,cool., ,mike@/deb40a:~/perl Could someone tell me why there is a comma printed after the

Re: print map question

2010-11-13 Thread Uri Guttman
MM == Mike McClain mike.j...@nethere.com writes: MM mike@/deb40a:~/perl perl -we ' MM @list=qw/Perl is cool./;print( list=\t, map { $_, } @list, \n); MM ' MM list= Perl,is,cool., MM ,mike@/deb40a:~/perl MM Could someone tell me why there is a comma printed after the newline?

Perl, pattern matching, substitution

2010-11-13 Thread Zachary Brooks
Hello, I'm taking a PhD course that requires the use of Perl and pattern matching. I've taken on the motto divide and conquer, but it hasn't quite worked. I appreciate anyone's help. The task is to extract sentences from a relatively large text file (928K, ca. 300 pages). But of course, the text

Re: Perl, pattern matching, substitution

2010-11-13 Thread Shawn H Corey
On 10-11-13 01:42 PM, Zachary Brooks wrote: 1. My first approach was to use substitute to get rid of a range of things betweenDOC and/DATELINE. A short version looks like this. $hello = DOC man at the bar order the/DATELINE; $hello =~ s/DOC.*\/DATELINE//gi; print $hello\n; I was about to

Re: Perl, pattern matching, substitution

2010-11-13 Thread Sheppy R
I've had similar issues and the \Q \E flags didn't fix it. One thing I've done to fix an issue where regex metacharacters are being caught is to do a replace on all of the characters to include a \ right in front. Something like this: open (my $FILE, , $file) or die $!\n; my @lines = $FILE; for

Re: Perl, pattern matching, substitution

2010-11-13 Thread Rob Dixon
On 13/11/2010 18:42, Zachary Brooks wrote: Hello, I'm taking a PhD course that requires the use of Perl and pattern matching. I've taken on the motto divide and conquer, but it hasn't quite worked. I appreciate anyone's help. The task is to extract sentences from a relatively large text file

Re: Help me learn Closures.

2010-11-13 Thread Randal L. Schwartz
Matthew == Matthew Young mab...@gmail.com writes: Matthew What are closures? How are they used? When should they be used? Where Matthew can I learn more about them? If you can borrow (or buy :) a copy of Intermediate Perl, I have an entire section on closures in there. -- Randal L. Schwartz -

Re: Bit testing

2010-11-13 Thread C.DeRykus
On Nov 11, 11:27 pm, c...@pobox.com (Chap Harrison) wrote: I'm almost embarrassed to ask this, but I can't figure out a simple way to construct a switch ('given') statement where the 'when' clauses involve bit-testing. Here's the only way I've figured out to build a switch statement that