Re: Bit testing

2010-11-14 Thread Shlomi Fish
Hi Charles, On Sunday 14 November 2010 01:47:36 C.DeRykus wrote: > On Nov 11, 11:27 pm, c...@pobox.com (Chap Harrison) wrote: > Not lots shorter but you could use a closure to hide > the calculation: > > my $mask; > for my $flags ( ... ) { > $mask = sub { return ($flags & $_[0]) == $_[0] } >

Re: Bit testing

2010-11-14 Thread C.DeRykus
On Nov 13, 3:47 pm, dery...@gmail.com ("C.DeRykus") wrote: > 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.

license setup for a Perl program

2010-11-14 Thread vajjra 007
Dear fellow members, I'm developing a Perl program that can be used on Linux hosts to perform certain tasks. Planning to release a premium version of the program that will be run on servers with public IP address for a low price. How can I setup a license system incorporated to the software? I un

Re: Bit testing

2010-11-14 Thread Chap Harrison
On Nov 14, 2010, at 4:36 AM, C.DeRykus wrote: > And now it seems a little bit > inelegant to redefine the closure each time through > the loop. > > > for my $flags ( ... ) { > my $mask = sub { return ($flags & $_[0]) == $_[0] }; > given( $flags ) { > when ( $mask->($one_a

Re: license setup for a Perl program

2010-11-14 Thread shawn wilson
On Sun, Nov 14, 2010 at 9:39 AM, vajjra 007 wrote: > Dear fellow members, > > I'm developing a Perl program that can be used on Linux hosts to perform > certain tasks. Planning to release a premium version of the program that > will be run on servers with public IP address for a low price. How ca

Perl, pattern matching, substitution, replacing

2010-11-14 Thread Zachary Brooks
Hello again, Yesterday I had a question on pattern matching. A couple of people responded with very useful information. After some finagling, I got my rudimentary code to work. I'm a PhD student studying computational linguistics without any formal programming training. While there are various mod

taint issue

2010-11-14 Thread shawn wilson
so, i'm guessing that i have to mess with ARGV when i use -T on my code? i'm getting this error: Insecure dependency in open while running with -T switch at /usr/lib/perl/5.10/IO/File.pm line 66 now, i didn't get this before spreadsheet::writeexcel. so i'm thinking that i can't use ARGV when i def

Re: Perl, pattern matching, substitution, replacing

2010-11-14 Thread shawn wilson
On Sun, Nov 14, 2010 at 11:42 AM, Zachary Brooks wrote: > Hello again, > > Yesterday I had a question on pattern matching. A couple of people > responded > with very useful information. After some finagling, I got my rudimentary > code to work. I'm a PhD student studying computational linguistics

Re: Perl, pattern matching, substitution, replacing

2010-11-14 Thread Shawn H Corey
On 10-11-14 11:42 AM, Zachary Brooks wrote: $hello = "This is some sample text."; $hello =~ s/^..//gi; $hello =~ s/..$/<\/s>/gi; print "$hello\n"; *is is some sample tex* The meta-character '.' matches every character except a newline. The first substitution replaces 'Th' with ''. The sec

Re: taint issue

2010-11-14 Thread shawn wilson
hummm, never mind. i decided to stop being stupid in multiple ways. i need to read more on writeexcel, and i've modified my crappy pass and moved that connector to another file so that i don't get stupid again: #!/usr/bin/perl -T use strict; use warnings; use Spreadsheet::ParseExcel; use Spread

Re: Perl, pattern matching, substitution, replacing

2010-11-14 Thread Uri Guttman
> "sw" == shawn wilson writes: sw> second, why not use a place holder like someone recommended yesterday? sw> something like: sw> s/^(.+)$/\1<\/s>/g what is a placeholder? nothing like that in regexes. what you have there is a backreference and used in the wrong place. \1 is meant to b

Re: Perl, pattern matching, substitution, replacing

2010-11-14 Thread shawn wilson
On Sun, Nov 14, 2010 at 1:53 PM, Uri Guttman wrote: > > "sw" == shawn wilson writes: > > sw> second, why not use a place holder like someone recommended yesterday? > sw> something like: > sw> s/^(.+)$/\1<\/s>/g > > what is a placeholder? nothing like that in regexes. what you have there >

Re: Perl, pattern matching, substitution, replacing

2010-11-14 Thread Zachary Brooks
What happened when I used the code -- $hello =~ s/^(.+)$/\1<\/s>/gis; -- is that is properly marked and the beginning of the sentence and at the end of the sentence, but then it only worked for one sentence. Any suggestions on getting to appear at the beginning of every sentence and to appea

Re: Perl, pattern matching, substitution

2010-11-14 Thread Rob Dixon
On 14/11/2010 13:53, Zachary Brooks wrote: Hey Rob, Of all the feedback. yours was the one I was able to drop into my code and make it work, no matter how rudimentary my understanding of Perl is. Thanks. You're welcome. I'm glad to be able to help. As far as the XML libraries, we are suppose

Re: Perl, pattern matching, substitution, replacing

2010-11-14 Thread shawn wilson
so, if you've got a file, do something like: while ($line = ) { $line =~ m/^(.+)$/ig; print "$1<\/s>\n"; } On Sun, Nov 14, 2010 at 1:53 PM, Uri Guttman wrote: > > "sw" == shawn wilson writes: > > sw> second, why not use a place holder like someone recommended yesterday? > sw> somethin

Re: Perl, pattern matching, substitution, replacing

2010-11-14 Thread Rob Dixon
On 14/11/2010 19:04, Zachary Brooks wrote: What happened when I used the code -- $hello =~ s/^(.+)$/\1<\/s>/gis; -- is that is properly marked and the beginning of the sentence and at the end of the sentence, but then it only worked for one sentence. Any suggestions on getting to appear at t

Re: Perl, pattern matching, substitution, replacing

2010-11-14 Thread Jim Gibson
At 2:16 PM -0500 11/14/10, shawn wilson wrote: so, if you've got a file, do something like: while ($line = ) { $line =~ m/^(.+)$/ig; print "$1<\/s>\n"; } If all you want to do is print each line in the file surrounded by tags, you don't need regular expressions, and you don't need to esca

Re: Bit testing

2010-11-14 Thread C.DeRykus
On Nov 14, 1:11 am, shlo...@iglu.org.il (Shlomi Fish) wrote: > Hi Charles, > > On Sunday 14 November 2010 01:47:36 C.DeRykus wrote: > > > On Nov 11, 11:27 pm, c...@pobox.com (Chap Harrison) wrote: > > Not lots shorter but you could use a closure to hide > > the calculation: > > > my $mask; > > for

Re: print map question

2010-11-14 Thread Mike McClain
On Sat, Nov 13, 2010 at 05:43:21AM -0500, Uri Guttman wrote: > > "MM" == Mike McClain writes: > MM> Could someone tell me why there is a comma printed after the newline? > because you put it there. the \n is input to the map, not the print! > map's last arg is a list and it takes @list AND