Re: Date::Parse and strange dates

2014-07-25 Thread Brian Fraser
On Fri, Jul 25, 2014 at 6:54 PM, Chris Knipe wrote: > Hi All, > > > > I have the odd (very rare) case where I am given a date in an incorrect > format. I already use Date::Parse to convert the dates to a unix timestamp, > and it’s working incredibly well. However, on the rare case that I get > i

Re: Re[2]: Where's this documented?

2014-03-19 Thread Brian Fraser
On Wed, Mar 19, 2014 at 10:37 AM, shawn wilson wrote: > On Wed, Mar 19, 2014 at 4:21 AM, Yonghua Peng wrote: > > From perldoc -f stat: > > > > If "stat" is passed the special filehandle consisting of an underline, no > > stat is done, but the current > > contents of the stat structure from the l

Re: Where's this documented?

2014-03-17 Thread Brian Fraser
On Mon, Mar 17, 2014 at 10:05 AM, shawn wilson wrote: > From Archive::Tar::File - what's '_' and where is it documented? > > sub _filetype { > my $self = shift; > my $file = shift; > > return unless defined $file; > > return SYMLINK if (-l $file); # Symlink > > return FI

Re: Operand evaluation order

2014-03-14 Thread Brian Fraser
On Fri, Mar 14, 2014 at 6:03 PM, Ralph Grove wrote: > I'm trying to determine how Perl evaluates operands for expressions. I > expected the following code to output 3, 4, and 5, as it would if executed > as a C++ or Java program. The actual output that I get (v5.16.2), however, > is 4, 4, and 5.

Re: Build Perl keyword hash

2014-03-13 Thread Brian Fraser
On Thu, Mar 13, 2014 at 2:29 PM, Alex Chiang wrote: > Hi all, > > I'd like to build a hash mapping from "keyword" => value. By keyword, I > mean all reversed words in http://learn.perl.org/docs/keywords.html. Do > you guys know any csv or text file containing all these words? > I don't want to har

Re: Installing Module::Build::Tiny from CPAN fails . . . because it requires Module::Build::Tiny!?! WTF?

2014-02-16 Thread Brian Fraser
On Sat, Feb 15, 2014 at 10:34 PM, Marc Perry wrote: > Has anyone else encountered this? I had to dig down deep in my testing > lore and run 'prove -v t/simple.t' before I could find the STDERR that > revealed this. When I reviewed the files in the Module, sure enough: > use Module::Build::Tiny (

Re: Turn part of a string into a single newline

2014-02-14 Thread Brian Fraser
On Fri, Feb 14, 2014 at 2:14 PM, Bill McCormick wrote: > Is this your homework? Does it matter? They've shown their work, what they expected to happen and what happened instead. I think the only missing bit would've been "I checked in X documentation and couldn't find the answer"

Re: Identifying the current opened filehandle for writing as I'm getting undefined variable concatenation errors

2014-01-14 Thread Brian Fraser
On Wed, Jan 15, 2014 at 12:09 AM, Matt McAdory wrote: > Is there a method for determining the currently selected filehandle? > should I always check for undef and open my filehandle before writing to it? > > use strict; > use warnings; > use autodie qw (:all); > > use My:CustomMod_with_FH_write;

Re: Problem printing double quotes in XML using XML::DOM

2013-11-30 Thread Brian Fraser
On Sun, Dec 1, 2013 at 7:28 AM, Shaji Kalidasan wrote: > Dear Shlomi, > > I tried to install https://metacpan.org/release/XML-LibXML in my windows > setup (using Strawberry Perl 5.18.1 on Windows 7) but it failed. Please > suggest where am I going wrong? > > Here is the output from console (comman

Re: How to reduce perl memory usage?

2013-10-13 Thread Brian Fraser
On Sun, Oct 13, 2013 at 8:51 AM, Manuel Reimer wrote: > Hello, > > I would like to use Perl on an embedded device, which only has 64MB of RAM. > > Are there any tricks to reduce the memory usage of the perl interpreter? > > Thanks in advance > > Greetings, > > Manuel You probably want to take th

Re: Need help with a programming problem

2013-10-02 Thread Brian Fraser
On Wed, Oct 2, 2013 at 8:19 PM, Shawn H Corey wrote: > On Wed, 02 Oct 2013 23:43:40 +0100 > Rob Dixon wrote: > > > > The file's name is \d{6}.htm > > > > do you mean that literal name, or do you want to include *.htm files > > that start with six decimal digits? Jim Gibson has assumed the former

Re: Need help with a programming problem

2013-10-02 Thread Brian Fraser
On Wed, Oct 2, 2013 at 4:44 PM, Peter Holsberg wrote: > Shawn H Corey has written on 10/2/2013 2:29 PM: > > On Wed, 02 Oct 2013 13:57:36 -0400 > > Peter Holsberg wrote: > > > >> I was so upset that I deleted it all! It seems to me that > >> it should be fairly straightforward, but at 79, the old

Re: Compilation 5.18.0 on RHEL 6.4 fails to use threads (?)

2013-09-19 Thread Brian Fraser
On Thu, Sep 19, 2013 at 8:16 AM, Alexander Karner wrote: > Hi! > > I got the list of options from there: * > http://mail.perlide.org/pipermail/padre-dev/2010-June/001863.html* > > But I checked a compilation with > sh Configure -d

Re: Compilation 5.18.0 on RHEL 6.4 fails to use threads (?)

2013-09-18 Thread Brian Fraser
On Wed, Sep 18, 2013 at 10:02 AM, Alexander Karner wrote: > Hi! > While I'm not a beginner with Perl it seems that I'm somewhat a beginner > if it comes to compilation: > > I try to compile 5.18.0 on my RHEL 6.4 system. Primarily in order to be > able to use Padre. > This is the command to create

Re: negate, !!$a, $a!!, flip-flop

2013-09-10 Thread Brian Fraser
On Mon, Sep 9, 2013 at 6:00 AM, Hans Ginzel wrote: > Hello! > > Is there a shorter way to write $a = ! $a, please? > > Something analogous to ++ and -- operators like $a !! or !! $a would negate > the variable $a and return its previous or new value respectively. > > Best regards Not really. Bu

Re: Single equals operator inside an if statement

2013-08-14 Thread Brian Fraser
On Wed, Aug 14, 2013 at 6:09 PM, Alexey Mishustin wrote: > 2013/8/15 Uri Guttman : > > On 08/14/2013 04:22 PM, Jim Gibson wrote: > >> > >> > >> On Aug 14, 2013, at 12:30 PM, Alexey Mishustin wrote: > >> > >>> Testing a value and assigning it - I have never done this at the same > >>> time... > >>

Re: Array iterator count

2013-08-08 Thread Brian Fraser
On Thu, Aug 8, 2013 at 2:05 PM, Unknown User wrote: > > Hello, > > > If i am iterating through the elements in an array, at any point is it > possible to say which element i am handling without using a counter? Are > there any builtins that i can use for it? > > ie > foreach my $element (a..z) { >

Re: what's the problem with a system call

2013-05-14 Thread Brian Fraser
On Tue, May 14, 2013 at 12:35 AM, xiaolan wrote: > Hello, > > what's the disadvantage when calling a system command from Perl? > i.e, system call to "rsync" rather than using the File::Rsync module. > is it hard to control the signals between the caller process and the > called system command? >

Re: Current time with DST

2013-04-18 Thread Brian Fraser
On Wed, Apr 17, 2013 at 10:24 PM, Brandon McCaig wrote: > On Thu, Apr 18, 2013 at 01:00:38AM +0100, Ricardo Pais Oliveira wrote: > > Hi! > > Hello, > > > I'm using DateTime::TimeZone to get my current time. Shouldn't daylight > > saving time be handled by the DateTime module? > > > > In $date I'm

Re: no warnings inside a loop

2013-04-03 Thread Brian Fraser
On Wed, Apr 3, 2013 at 8:29 PM, Angela Barone wrote: > I'm just curious about this. If you put "no warnings" inside a > loop, is it good only for that loop, or will it be in effect until the end > of the script? > > Only for the loop -- warnings, along with most other pragmas (strict, fea

Re: Local static HTML tree of Perl POD similar to perldoc.perl.com?

2013-04-02 Thread Brian Fraser
On Tue, Apr 2, 2013 at 10:27 PM, David Christensen < dpchr...@holgerdanske.com> wrote: > beginners: > > I would like to create static HTML trees of Perl documentation, similar to > perldoc.perl.com: > > 1. Is there a canonical system path (directory) for such? Is there a > canonical per-user pat

Re: Dynamically created perl script

2013-03-18 Thread Brian Fraser
On Mon, Mar 18, 2013 at 11:46 PM, Ronald Weidner wrote: > I need to execute a Perl program that is about 1000 lines of code long. The > Perl program is dynamically generated by another program. I would like to > execute the Perl program without first creating the Perl source code file. > In o

Re: CPAN and AI::Prolog

2013-03-13 Thread Brian Fraser
On Wed, Mar 13, 2013 at 9:18 AM, John Sampson wrote: > Hello - > > I installed Strawberry Prolog on Windows 7 and tried to install AI::Prolog > from the CPAN. > As far as I can see from the slew of messages this failed due to lack of > software packages > on which it depends (or depended). > I hav

Re: Line Endings

2013-02-26 Thread Brian Fraser
On Mon, Feb 25, 2013 at 2:38 PM, Brandon McCaig wrote: > On Sun, Feb 24, 2013 at 11:17:40PM -0300, Brian Fraser wrote: >> my $over = ''; >> while ( sysread( $fh, $over, 8192, length($over) ) ) { >> while ( $over =~ /\R/ ) { >> my $line =

Re: Line Endings

2013-02-24 Thread Brian Fraser
On Fri, Feb 22, 2013 at 3:08 PM, Tiago Hori wrote: > Hi All, > > One problem that often encounter is with line endings. I have to parse > several kinds of files routinely and often these are generated in excel and > therefore it is hard to anticipate which line ending I actually have. It > seems t

Re: .profile not being read

2013-02-20 Thread Brian Fraser
On Tue, Feb 19, 2013 at 10:29 PM, Gerard Walschap wrote: > I see. There is a .bashrc file in my home directory with the line > - > source /Users/gerard/perl5/perlbrew/etc/bashrc > - > So I guess installing perl did override my .profile, although I'm not sure > how.

Re: ok how about this: source code compressor

2013-02-15 Thread Brian Fraser
On Fri, Feb 15, 2013 at 8:19 PM, Rajeev Prasad wrote: > it not only decreases the size, to load in RAM, also make it 'little harder' > for cocky-novices to steal the tricks (perl guru's anyway dont care). > > > http://www.stunnix.com/prod/po/ (binary not present to download??) > http://blueboxte

Re: how to get a sequence of 01 02 ..

2012-06-11 Thread Brian Fraser
On Mon, Jun 11, 2012 at 10:49 AM, lina wrote: > Hi, > > > $ for i in `seq -f '%02g' 1 10` ; do echo $i ; done > 01 > 02 > 03 > 04 > 05 > 06 > 07 > 08 > 09 > 10 > > I wonder how can I get something like above in the perl. > > for my $i ("01".."10") { say $i; }

Re: work with hexadecimal values

2012-03-08 Thread Brian Fraser
On Thu, Mar 8, 2012 at 10:24 AM, wrote: > Hi > > I have one range of hexadecimal numbers like : 415A till 415F . > I need to find all other numbers between this 2 . Is there any Perl > function which will help to find all numbers or any other way in Perl ? > > > Thanks > Sunita > my @numbers = h

Re: Scalar::Util::blessed() considers Regexp references to be blessed?

2012-01-23 Thread Brian Fraser
On Mon, Jan 23, 2012 at 2:12 AM, David Christensen < dpchr...@holgerdanske.com> wrote: > beginners@perl.org: > > While coding some tests tonight, I discovered that Scalar::Util::blessed() > considers Regexp references to be blessed. > > > Is this a bug or a feature? > Implementation detail. Inter

Re: Some UTF-8-related questions

2012-01-11 Thread Brian Fraser
On Wed, Jan 11, 2012 at 7:59 AM, Hamann, T.D. (Thomas) < ham...@nhn.leidenuniv.nl> wrote: > Hi, > > Thanks for the answers on my last question. I have since then dug a bit > further in the UTF-8-related error message I got, and after some reading > have a few questions with regards to UTF-8 handli

Re: Help in finding group of text

2011-12-23 Thread Brian Fraser
On Sat, Dec 24, 2011 at 2:44 AM, Kenneth Wolcott wrote: > On Fri, Dec 23, 2011 at 21:34, Saravanan Murugaiah > wrote: > > Dear All, > > > > In my text file, the following occurrence are there: > > > > begin > > some of group of text some of group of text some of group of text > > some of group of

Re: Perl to python converter

2011-12-23 Thread Brian Fraser
On Fri, Dec 23, 2011 at 5:14 AM, a b wrote: > Any thoughts? > Sure. It's called a "college student". You hire one to do the job for you.

Re: module for development

2011-12-15 Thread Brian Fraser
On Thu, Dec 15, 2011 at 12:00 PM, Shawn H Corey wrote: > On 11-12-15 09:02 AM, Ken Peng wrote: > >> BEGIN { >> my $module_dir = $INC{'Net/Evernote.pm'}; >> $module_dir =~ s/Evernote\.pm$//; >> unshift @INC,$module_dir; >> } >> >> This begin block setup the @INC by adding a path as the

Re: module for development

2011-12-15 Thread Brian Fraser
On Thu, Dec 15, 2011 at 11:02 AM, Ken Peng wrote: > 2011/12/15 Brian Fraser : > > > > The second way is using an @INC hook, which is explained in perldoc -f > > require. Here's a pretty simple form: > > > > BEGIN { unshift @INC, sub { say "@_[0..$#_]

Re: module for development

2011-12-15 Thread Brian Fraser
On Thu, Dec 15, 2011 at 10:09 AM, shawn wilson wrote: > Strace stat(64) should do you. > On Dec 15, 2011 8:03 AM, "Ken Peng" wrote: > > > Hello, > > > > Which module could show the order of loading modules? > > For example, > > > > use Foo; > > use Bar; > > > > BEGIN { > > require A; > > } >

Re: extracting email addresses from a file

2011-12-06 Thread Brian Fraser
On Tue, Dec 6, 2011 at 2:38 PM, Randal L. Schwartz wrote: > > "Rob" == Rob Coops writes: > > Rob> The biggest problem with email addresses is that the rules of how an > email > Rob> address can be formatted are so relaxed and thus so complex that > there is > Rob> to the best of my knowledge

Re: what's the error?

2011-11-06 Thread Brian Fraser
On Sun, Nov 6, 2011 at 2:34 AM, John W. Krahn wrote: > Brian Fraser wrote: > >> On Sat, Nov 5, 2011 at 7:25 PM, John W. Krahn wrote: >> >> Brian Fraser wrote: >>> >>> On Sat, Nov 5, 2011 at 3:54 PM, Shawn H Corey >>>> wrot

Re: what's the error?

2011-11-05 Thread Brian Fraser
On Sat, Nov 5, 2011 at 7:25 PM, John W. Krahn wrote: > Brian Fraser wrote: > >> On Sat, Nov 5, 2011 at 3:54 PM, Shawn H Corey >> wrote: >> >> On 11-11-05 02:40 PM, Brian Fraser wrote: >>> >>> See `perldoc readline`. $! wi

Re: what's the error?

2011-11-05 Thread Brian Fraser
On Sat, Nov 5, 2011 at 3:54 PM, Shawn H Corey wrote: > On 11-11-05 02:40 PM, Brian Fraser wrote: > >>See `perldoc readline`. $! will be undefined if no error occurs. >> >> >> No. >> > > $! will be undefined, not `undef` > > That's silly.

Re: what's the error?

2011-11-05 Thread Brian Fraser
On Sat, Nov 5, 2011 at 3:04 PM, Shawn H Corey wrote: > On 11-11-05 01:49 PM, Uri Guttman wrote: > >> readline isn't a system call so it can't set $!. >> >> $! maps to the errno of system calls and has both the text and numeric >> values of the actual error (only if one happens) of the last system

Re: HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

2011-10-22 Thread Brian Fraser
On Sat, Oct 22, 2011 at 4:57 PM, Brandon McCaig wrote: > On Sat, Oct 22, 2011 at 11:37 AM, timothy adigun <2teezp...@gmail.com> > wrote: > > my($filesys,$mbytes,$used,$avail,$capacity,$mount)=("","","","","",""); > > Declaring these variables here is useless (and initializing them > here is even

Re: Perl 5.12.1 manual install - make test problem.

2011-10-20 Thread Brian Fraser
2011/10/20 Rafał Radecki > Hi all. > I am installing locally perl using howto > http://www.mail-archive.com/padre-dev@perlide.org/msg00363.html . > When I make make test I returns message about an error in > porting/checkcase.t and a hint to: > export LD_LIBRARY_PATH=`pwd`;cd t;./perl harness > T

Re: regex help

2011-10-17 Thread Brian Fraser
On Tue, Oct 18, 2011 at 12:32 AM, Chris Stinemetz wrote: > /17|18|19|20|21+:(\d+):(\d+)+\n+\n+CELL\s+(\d+)\s+(.+?),.+?HEH/ Spot the issue: / 17#Or | 18#Or | 19#Or | 20#Or | 21+:(\d+):(\d+)+\n+\n+CELL\s+(\d+)\s+(.+?),.+?HEH /x For anything but 21, the regex is on

Re: regex help

2011-10-10 Thread Brian Fraser
On Mon, Oct 10, 2011 at 4:56 PM, Chris Stinemetz wrote: > Any help is appreciated. > > Once I match HEH how can alter the program to print the contents that > are in the two lines directly above the match? > > For example in this case I would like the print results to be: > > **01 REPT:CELL 983 C

Re: encoding and PDF::API2

2011-10-07 Thread Brian Fraser
On Fri, Oct 7, 2011 at 5:39 AM, Igor Dovgiy wrote: > Hi Marcos, > my %pdf_info = $pdf->info(); > foreach (keys $pdf_info) { >$pdf_info{$_} =~ s/[^\x00-\xFF]//g; > } > Perhaps that'll do? ) > > Nope. That'll restrict the text to the latin-1 charset.

Re: encoding and PDF::API2

2011-10-07 Thread Brian Fraser
On Fri, Oct 7, 2011 at 12:19 PM, Brandon McCaig wrote: > > I know next to nothing about Unicode programming (in any > language), but it seems to always be the same prefix. Printing > this out in Windows' cmd shell seems to yield the same prefix > that I see in UTF-8 files with a BOM (byte-order m

Re: encoding and PDF::API2

2011-10-07 Thread Brian Fraser
On Fri, Oct 7, 2011 at 4:54 AM, marcos rebelo wrote: > Hi all > > I'm trying to get the info from a PDF with a code like: > > ### > > ... > use Data::Dumper; > use PDF::API2; > ... > my $pdf = PDF::API2->open('/home/.../PDF.pdf'); > print Dumper

Re: Matching Greek letters in UTF-8 file

2011-09-29 Thread Brian Fraser
On Thu, Sep 29, 2011 at 4:03 PM, John Delacour wrote: > > Nitpick: Why the upper-case charset name? > Uppercase is UTF-8-strict, while lowercase is the lax version that perl uses internally. Unless you are passing data from one perl program to another, and you are using illegal-UTF8-but-legal-UT

Re: Matching Greek letters in UTF-8 file

2011-09-29 Thread Brian Fraser
On Thu, Sep 29, 2011 at 10:58 AM, John Delacour wrote: > use encoding 'utf-8'; > > Nitpick: Please don't use this, as encoding is broken. use utf8; and use open qw< :std :encoding(UTF-8) >; should make do for a replacement. To the original poster, please note that there's a bit of a difference i

Re: Sandboxing while I am learning

2011-08-31 Thread Brian F. Yulga
erl to my home directory is inconsequential when weighed against the ease of using one tool to do the job. Each to their own. Besides saved disk space and install time, I'd be interested in knowing if I've overlooked some other advantage of local::lib over perlbrew. Brian -- To

Re: How to run a perl script in background on Windows?

2011-08-03 Thread Brian F. Yulga
l script.pl Type "start /?" at a cmd prompt to read about the "/B" switch. With this switch, you'll still have the cmd.exe window open, but the prompt will return immediately. Also, I use this with Strawberry Perl; I don't know if ActiveState has other tricks

Re: is there //= operator?

2011-08-02 Thread Brian Fraser
On Wed, Aug 3, 2011 at 2:32 AM, terry peng wrote: > I have forgot that, is there a //= operator in Perl? > which should do the same stuff as: > > unless (defined($foo) ) { >$foo = ...; > } > > Thanks. > > Yes. Now wasn't that simple? : ) It's the defined-or, and you can read more about it on

Re: Characters

2011-08-01 Thread Brian Fraser
On Mon, Aug 1, 2011 at 9:14 AM, Emeka wrote: > > In some languages string type is just array/list of characters. What is it > in Perl? > > There's no string type in Perl, internals notwithstanding. There's scalars, and a scalar can hold a string - If you care to dig deeper, that string is stored

Re: parsing script duplication of lines issue, please advise

2011-07-21 Thread Brian Fraser
On Thu, Jul 21, 2011 at 8:17 AM, Nathalie Conte wrote: > I forgot to say that the extra lines are empty... but I don't understand > why they are there :) > > That's rather simpler, since there's nothing in the program that could cause double output (unless you ran it twice :P). The issue is that

Re: grep question

2011-07-19 Thread Brian Fraser
On Tue, Jul 19, 2011 at 4:23 PM, Steven Surgnier wrote: > Hi, > > I desire a concise conditional statement which simply checks if each entry > in an array matches a given string. For example: > > print "all the same" if (grep {m/test_name/} @bins) == scalar @bins); > > #END CODE > > I thought, "g

Re: Timeout for user input

2011-06-17 Thread Brian Fraser
; > ~Parag > Cool. Good luck with that. Brian.

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Brian F. Yulga
shawn wilson wrote: On Sun, Jun 12, 2011 at 14:38, Brian F. Yulga wrote: perl -MFile::Find -wle "find( sub{ /\.mp3$/i and print;}, q(.));" just curious, what's the difference (in speed or results) between this and 'dis/a/s/b *.mp3'? obviously File::Find a

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Brian Fraser
); ... # mp3 filename getting code of your choice if ( any { /\P{ASCII}/ } @mp3_files ) { @mp3_files = map { Encode::decode( "UTF-8", $_ ) } @mp3_files; } Handling Unicode is hard word[1] :( Brian. [0] http://www.i-programmer.info/programming/other-languages/1973-unicode-issu

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Brian F. Yulga
n DOS (doesn't sort, just prints as it gets 'em): perl -MFile::Find -wle "find( sub{ /\.mp3$/i and print;}, q(.));" perl -MFile::Find -wle "find( sub{ /\.mp3$/i and print $File::Find::name;}, q(.));" The first I tend to use when I just want an "existence che

Re: perl alias

2011-06-11 Thread Brian Fraser
On Sat, Jun 11, 2011 at 5:15 PM, Mike McClain wrote: > > # set up an alias for the fastest prime generator > *primes = \&sieve_eratosthenese_lucky; > > Just use that, but wrap it in a BEGIN block.

Re: how do i push a hashref into another hashref

2011-06-07 Thread Brian F. Yulga
Leo Lapworth wrote: Hi Agnello, On 7 June 2011 07:47, Agnello George wrote: I got the following hashref now i need to push $select_all_website into $selet_domU_data I think this is what you want... use strict; use warnings; my $hash_ref_1 = { a => 1,

Re: Using $variable outside a foreach loop

2011-06-03 Thread Brian Fraser
humb is that leaving off the my in a for(each) is probably introducing subtle bugs into your program. Brian.

Re: practical perl guides

2011-05-28 Thread Brian Fraser
s to learning a new language. Program regularly, and pick your sources well (i.e. a good book, not as crappy web tutorial from ten years ago), that's about as much as you can do. Brian.

Re: help me with a parsing script please

2011-05-12 Thread Brian Fraser
ide a function ... } Or you keep the @list array, but do some magic with Tie::File[5]: use Tie::File; tie @list, 'Tie::File', $file or die ...; my $index = 1; #To skip the header while ( $index < $#list ) { # Or use a traditional for loop. my $one = $list[$index++]; my

Re: Help with regular expressions

2011-05-09 Thread Brian Fraser
(?&INITIALS) ) (? \p{Lu}\p{L}* ) (? (?:\p{Lu}\.)+ ) (? \p{PosixDigit}{4} ) (? [^.]{1,52} ) #Article title (? \P{PosixDigit}+ ) #Journal name (? \p{PosixDigit} ) #A generic number. Maybe just Digit? ) /x; #Assuming it succeed, the results are in the %+ hash: my @names = split /(?<=\.),\s*/, $+{al

Re: special character regex match

2011-05-05 Thread Brian Fraser
r-ending battle. Meanwhile, there only a handful of character that you actually want - Mayhaps /^\p{L}+$/ will do the trick? Brian.

Re: better way of writing this script

2011-04-29 Thread Brian Fraser
On Fri, Apr 29, 2011 at 5:02 AM, Uri Guttman wrote: > > also why use qw for sequential numbers when a range will do? > > Because I went stupid and just blindly copypasted instead of thinking :) Seriously, why use qw when I'm not _quoting words_? > so you can streamline yours with a slice: > > m

Re: better way of writing this script

2011-04-29 Thread Brian Fraser
On the other hand, if you mean more idiomatic way.. That's also subjective :P But here's my stab at it: my $status = join '', grep defined $jvalue{$_}, qw( 0 1 2 3 4 5 ); Brian.

Re: Regular expression help !!

2011-04-27 Thread Brian Fraser
unpack [1]: use 5.010; while () { say join ',', (unpack "A5 A24 A*")[0,-1]; } You can learn more about pack/unpack in perlpacktut[2] Or you could use substr[3]: while () { chomp; say join ',', substr($_, 0, 4), substr($_, 29); } Brian. [0] http://perldoc.p

Re: Help with indentation

2011-04-24 Thread Brian Fraser
sub match_against { my ($string, $regex) = @_; return $string =~ $regex ? "matched, with \$1 => [$1]" : "didn't match."; } :) Just in case, drop the caps everywhere! :P Brian.

Re: Help with indentation

2011-04-24 Thread Brian Fraser
On Sun, Apr 24, 2011 at 5:42 PM, Tiago Hori wrote: > Hi Brian and List > > > http://ideone.com/kk0OI > > I was studying the references about regular expression you pointed me to on > the link above and I just wanted make sure I understand properly. You used > the \Q

Re: Help with indentation

2011-04-23 Thread Brian Fraser
n"; } And then this: open(FILE, "<@_[0]"); Which should probably be open my $file, '<', $_[0]; A nitpick, but you also have an $index variable that you don't use. You can probably also let go of that grep and replace it with a smart match: if ($seqhead

Re: Nature of this list

2011-04-23 Thread Brian Fraser
here exactly to demonstrate that a few strong words shouldn't matter in your appreciation of a message. I guess that misfired, though. Brian.

Re: Nature of this list

2011-04-23 Thread Brian Fraser
respectful silence as I'm not an expert, but well. I have a soft spot for science, which can probably be "traced back to a math or science teacher" (or blogger) that I appreciate :p) Brian.

Re: Real Beginner

2011-04-21 Thread Brian F. Yulga
a beginners list at all. I think it, as Cat Stevens would say, a wild world out there, but some of us are just trying to get by. That's my view from outside, really outside. I hear ya! Keep trying :-) Brian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Unintended behavior: Range operator inside a while loop continues to pattern match on the subsequent file

2011-04-21 Thread Brian Fraser
http://www.effectiveperlprogramming.com/blog/314 Brian. On Thu, Apr 21, 2011 at 2:42 PM, Marc Perry wrote: > Hi, > > I was parsing a collection of HTML files where I wanted to extract a > certain > block from each file, like this: > > > ./script.pl *.html &

Re: devices without division

2011-04-20 Thread Brian Fraser
On Wed, Apr 20, 2011 at 7:58 AM, Saran wrote: > Here is the program > > use strict; > use warnings; > > my ($div,$reminder) = ÷_now(20,4); Please don't call subs with &; It'll bite you in the arse eventually. You can read why in perldoc perlsub[0], or well

Re: Nature of this list

2011-04-19 Thread Brian F. Yulga
of the current debate, I feel the viewpoints people have contributed to the list are all insightful, and not excessively negative in tone. Shall we all say "bygones" and move on? ;-) Brian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How to test for 2 words from a list in a form field?

2011-04-09 Thread Brian F. Yulga
Brian F. Yulga wrote: my @mail_types = qw( avenue road box lane ); my @words = split /\s/, $fields; my $count = grep { my $found; foreach my $street ( @mail_types ) { if ( /\b$street\b/i ) { $found++; last; } } $found; } @words; print qq

Re: How to test for 2 words from a list in a form field?

2011-04-09 Thread Brian F. Yulga
_types = qw( avenue road box lane ); my @words = split /\s/, $fields; my $count = grep { my $found; foreach my $street ( @mail_types ) { if ( /\b$street\b/i ) { $found++; last; } } $found; } @words; print qq(found $count address types\n) if ( $c

Re: regular expression for email id and IP address

2011-04-09 Thread Brian Fraser
use Regexp::Common qw/ net /; $ip =~ /$RE{net}{IPv4}/;

Re: REGEX Explanation

2011-04-08 Thread Brian Fraser
= split /(?:(?:a|b)+)/, $x; > split /[ab]+/, $x; makes this a lot less complex : ) Brian.

Re: Mix of English and Cyrillic Characters

2011-04-02 Thread Brian Fraser
c}\p{Block: Cyrillic_Extended_A}\p{Block: Cyrillic_Extended_B}\p{Block: Cyrillic_Supplement}]+//g; Brian. [0] http://perldoc.perl.org/perluniprops.html

Re: transposing %d values to %x output

2011-03-29 Thread Brian Fraser
//www.nntp.perl.org/group/perl.perl5.porters/2011/03/msg170010.html Brian.

Re: transposing %d values to %x output

2011-03-29 Thread Brian Fraser
ay. Warning beginners of the pitfalls of \d and friends, however, is the way to go: I live in a country where ASCII doesn't make up the entire character set, but everyone in my office seems to think that it does. I constantly wish someone would've taught them better whenever they started pro

Re: Filling in an online form.

2011-03-28 Thread Brian F. Yulga
rch.cpan.org/~markov/MailTools-2.07/lib/Mail/Mailer.pod Hope that gets you a start. Brian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: problem with naming of variables

2011-03-28 Thread Brian Fraser
On Mon, Mar 28, 2011 at 12:10 PM, Katya Gorodinsky < katya.gorodin...@ecitele.com> wrote: > $random_bet_position = int(rand(3) + 1); > > $name = 'bet' . $random_bet_position; > @selected_bet = @{$name}; > > No no no. Gosh no. Don't do that. http://perl.plover.com/varvarname.html Brian.

Re: assigning hash to a scalar

2011-03-26 Thread Brian Fraser
Chas++ I don't get to see Algorithms in college, so I doubly appreciate explanations like this, in the one language I sort of grok* :) You've made my morning, thank you! Brian. *Also the reason I'm trying to hunt down a copy of Mastering Algorithms with Perl. On Sat, Mar 26,

Re: Better Regrex

2011-03-23 Thread Brian Fraser
, delete it from everywhere in the script", you could do something like > s/$+{word}//g while s/ \# (? \w+ ) //x; > This uses named captures, explained in perlretut and perlre[2]. You could do without them though. Brian. [0] http://perldoc.perl.org/perlretut.html#Using-regular-expressi

Re: File/Slurp module

2011-03-19 Thread Brian Fraser
Googling your error: http://stackoverflow.com/questions/1918672/why-does-git-pm-on-cygwin-complain-about-out-of-memory-during-large-request Brian. On Sat, Mar 19, 2011 at 4:30 PM, Chris Stinemetz < cstinem...@cricketcommunications.com> wrote: > Uri, > > When I try to parse one of

Re: Parse Key=Val parameters with s///eg

2011-03-18 Thread Brian Fraser
programmer some headache. And if doing it in one go is a requirement for whatever reason, using Regexp::Grammars[1] instead is probably a much better solution. Brian. [0] http://search.cpan.org/~dconway/Regexp-Grammars-1.012/lib/Regexp/Grammars.pm On Fri, Mar 18, 2011 at 7:24 PM, Chap Harrison

Re: ip address substitution

2011-03-16 Thread Brian Fraser
/x does exactly what you think it does; It's "free form" style, where any non-escaped whitespace is ignored. See perlretut[0], perlop[1], and perlre[2]. (?http://perldoc.perl.org/perlretut.html [1] http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators [2] http://perldoc.perl.org/perlre.h

Re: Using regex special characters from a string

2011-03-09 Thread Brian F. Yulga
Thanks for the reading suggestions! Brian Fraser wrote: On Wed, Mar 9, 2011 at 2:22 PM, Brian F. Yulga mailto:byu...@langly.dyndns.org>> wrote: Uri and Jim have hit upon one of my major stumbling blocks with learning Perl. There seems to be a difference of opinion on the

Re: Using regex special characters from a string

2011-03-09 Thread Brian Fraser
On Wed, Mar 9, 2011 at 2:22 PM, Brian F. Yulga wrote: > Uri and Jim have hit upon one of my major stumbling blocks with learning > Perl. There seems to be a difference of opinion on the proper times to use > hashes vs. arrays/lists...and how best to use them. http://perldoc.perl.org

Re: Using regex special characters from a string

2011-03-09 Thread Brian F. Yulga
Ben Lavery wrote: > there must be a slight trade-off... the processing required to > initialize the hash table with it's keys and values is probably > more intensive than defining an array with its respective values? > Unless, internally, Perl stores arrays as hashes, with the indexes > as the ke

Re: Using regex special characters from a string

2011-03-09 Thread Brian F. Yulga
Jim Gibson wrote: On 3/9/11 Wed Mar 9, 2011 9:22 AM, "Brian F. Yulga" scribbled: > > foreach ( @word_list ) { if ( /^$temp_word$/i ) { push( > @all_combinations, ( $_ )); } } That is pretty much what the grep function is doing. It has to iterate over the entire arr

Re: Using regex special characters from a string

2011-03-09 Thread Brian F. Yulga
ep a list" (as Jim suggests) instead of "scan an array", shouldn't the list manipulation be more efficient (or at least equivalently efficient) to a hash lookup? Thanks in advance for your sharing your thoughts... Brian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Auto correction of typos

2011-03-07 Thread Brian F. Yulga
mming logic you would need. Notice that it requires a suitable dictionary of reference words (e-mail domains for your case) so you would still have a lot of work to do... Good Luck! Brian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: multidimensional array check

2011-03-04 Thread Brian F. Yulga
Shawn H Corey wrote: On 11-03-04 02:30 PM, Brian F. Yulga wrote: > my brain nearly exploded when reading the section "returning a > subroutine from a subroutine" Just wait until you get to the part where you can treat an anonymous subroutine as an object. :D For details,

  1   2   3   4   5   6   7   >