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: 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
On Fri, Jun 17, 2011 at 10:39 AM, Parag Kalra wrote: > Hi, > > I have a requirement where I want to wait for user to input the data. > > However if user doesn't input the data within certain period of time then > it > should timeout and move ahead. > > TIA > > ~Parag > Cool. Good luck with that

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

2011-06-12 Thread Brian Fraser
use File::Find::Rule; my @mp3_files = File::Find::Rule->file->name(qr/ \. mp3$ /x)->in("C:/"); Tada. The problem with this (and all previous) solutions is that, if you have filenames with non-English (bah, ascii/latin-1) characters, you'll get a bunch of garbage instead. I'm not aware if there's

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: Using $variable outside a foreach loop

2011-06-03 Thread Brian Fraser
On Fri, Jun 3, 2011 at 1:23 PM, Jim Gibson wrote: > Declare the variable just before the loop, and remove the 'my' from the > foreach statement: > > my $name; > foreach $name ( ... ) { > ... > } > That won't do. What that code actually translated to is my $name; for my $name ( ... ) { ... } Wi

Re: practical perl guides

2011-05-28 Thread Brian Fraser
On Sat, May 28, 2011 at 4:47 AM, Shlomi Fish wrote: > On Friday 27 May 2011 20:34:51 shawn wilson wrote: > > When my perlish gets a bit fuzzy, a strong drink at a bar always helps me > > straighten things out :) > > > > That said, I use 'perl -e' if I'm fuzzy and the drink only made my > perlish

Re: help me with a parsing script please

2011-05-12 Thread Brian Fraser
On Thu, May 12, 2011 at 6:23 AM, Nathalie Conte wrote: > I have this script to split and iterate over each line, but I don't know > how to group 2 lines together, and take the start of the firt line and the > end on the second line? could you please advise? thanks > > You have a couple of option

Re: Help with regular expressions

2011-05-09 Thread Brian Fraser
On Mon, May 9, 2011 at 6:35 PM, Kenneth Wolcott wrote: > Hasn't someone already fixed this problem? If there isn't a CPAN module to > perform standardized bibliographic reference formatting/parsing. I haven't > looked at CPAN; did either of you? If a CPAN module doesn't exist, one > should! >

Re: special character regex match

2011-05-05 Thread Brian Fraser
On Thu, May 5, 2011 at 7:55 AM, Rob Coops wrote: > /\/|%|\$|\#\#|\s/g > Why not just a character class? It's usually a bad idea to use alternation in these cases. m!^[/%#\s\$]+$! should do the trick. Or if there must be three #'s in a row, perhaps m!^ (?: [/%\s\$]+ | \#{3} )+ $!x ? In any case,

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 Fri, Apr 29, 2011 at 4:27 AM, Agnello George wrote: > Hi All > > is there a better way of writing this script > > "Better" is fairly subjective - And with only a part of the program, there isn't much that can be said. Is $status a global variable, or lexical? On the other hand, if you mean mo

Re: Regular expression help !!

2011-04-27 Thread Brian Fraser
On Wed, Apr 27, 2011 at 2:48 PM, Shawn H Corey wrote: > On 11-04-27 12:47 PM, Jim Gibson wrote: > >> The metasymbol \d matches the characters [0-9], not the extended >> hexadecimal >> set that includes A-Z. To match those, construct your own character class: >> >> [0-9A-Z] >> > > You can use the

Re: Help with indentation

2011-04-24 Thread Brian Fraser
On Sun, Apr 24, 2011 at 11:18 PM, Uri Guttman wrote: > a small request. you can post link to pastebots but also paste the code > in emails here. i can reply and quote code better staying in my emailer > than going back and forth to a web page. emacs does a fine job of > marking off quoted emails

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 just in case there is a metac

Re: Help with indentation

2011-04-23 Thread Brian Fraser
On Fri, Apr 22, 2011 at 10:08 PM, Tiago Hori wrote: > Hi List, > > Howdy. Before we start, instead of using wikipedia, if you can get your hands on it and feel like spending a few hours of your time, Perl Best Practices[0] is the way to go. However, assuming that you are a busy person (and, as a

Re: Nature of this list

2011-04-23 Thread Brian Fraser
On Sat, Apr 23, 2011 at 4:15 PM, Marilyn Sander, Ken Armstrong < marilyn-san...@earthlink.net> wrote: > The F-bomb is totally unnecessary. Such language is for teenagers who do > not yet know how to communicate displeasure effectively. Please grow up. > Personally, I am finding this discussion f

Re: Nature of this list

2011-04-23 Thread Brian Fraser
Please people. I urge you all to kindly fuck off. This is getting ridiculous. You are arguing about *tone*. Who gives a flying fuck about tone if the post has substance? Are we fucking two? Are our egos so fragile that we can't take the slightest of drubbings? So sensitive that a word in caps can

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 > > my $accumulator; > my $capture_coun

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, this mailing list. Brian. [0] htt

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
This is a nitpick, but.. On Fri, Apr 8, 2011 at 9:34 AM, Shawn H Corey wrote: > To get it to capture the sequence of a's and b's, use: > > > @num = split /((?:a|b)+)/, $x; > > To get it to not capture any matches, use the non-capture parentheses: > > > @num = split /(?:(?:a|b)+)/, $x; > split /[a

Re: Mix of English and Cyrillic Characters

2011-04-02 Thread Brian Fraser
I don't really know the first thing about Cyrillic, so you'll probably have to play around with this before making it work like you want it to. It makes use of Unicode character properties, which you can start learning from perluniprops[0]: $text =~ s/[\p{Cyrillic}\p{Block: Cyrillic}\p{Block: Cyri

Re: transposing %d values to %x output

2011-03-29 Thread Brian Fraser
On Wed, Mar 30, 2011 at 12:46 AM, Chas. Owens wrote: > > If you are dealing exclusively with ASCII, then you should be using > the [bytes][0] pragma; It's nitpicky, but I'd advice against ever recommending use bytes in the beginners list. Or any list really. See: http://www.nntp.perl.org/group

Re: transposing %d values to %x output

2011-03-29 Thread Brian Fraser
On Tue, Mar 29, 2011 at 11:03 PM, Jim Gibson wrote: > > The statement "To match the ASCII digit characters you must use [0-9]" is > wrong. I believe you meant to say "To match the ASCII digit characters and > only those characters, you must use [0-9]". Or \p{PosixDigit}; Teach new people Unicode

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, 2011 at 8:40 AM, Ch

Re: Better Regrex

2011-03-23 Thread Brian Fraser
Regex, or maybe regexp, but not regrex.. That doesn't make any sense : p I have no idea what you mean with "section in red." However, there's a few things wrong with your code: What is $mark? Don't you mean $marker? As it stands, your snipped would die under strict, and in non-strict $mark would b

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 my raw files I

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

2011-03-18 Thread Brian Fraser
Yes and no. Technically I suppose you can, maybe doing something like this: use 5.010; use Data::Dumper; $_ = "KEYWORD = VALUE MIN=2 MAX, = 12 WEIGHTED TOTAL= 20 WHAT =, 12 TEST = 1000"; our %results; m! (?&RECURSE) (?(DEFINE) (? (?&BAD_LVSIDE)|(?&BAD_RVSIDE) ) (? (?&P_PLUS) = (?&P_STAR) ) (? (

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 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/perlfaq4.ht

Re: Dereferencing problem

2011-02-23 Thread Brian Fraser
In a fairly modern Perl, you could use each[0]: while (my ($index, $value) = each @array) { ... } However, fixing your original problem is simple enough: #my @personen = @$personen; #Commenting this one out because I don't like having two variables with the same name. for ( my $i = 0; $i <= $

Re: cleaning regular expression output

2011-02-18 Thread Brian Fraser
As a disclaimer, I'm in the middle of reading Mastering Regular Expressions[0], so my head isn't in the right place. None of these solutions should be used in production code ever, probably. Assuming something like 1,000,000,000,123,212,888,546,248 is in $_, Using only a match, no substitution: s

Re: x,y axis graph

2011-02-15 Thread Brian Fraser
On Tue, Feb 15, 2011 at 11:35 PM, Chris Stinemetz < cstinem...@cricketcommunications.com> wrote: > I am interested in creating a cgi perl script that I can publish on the web Cool. Any suggestions are greatly appreciated. > I think that maybe learning some Perl would be a solid first step. Bria

Re: understanding the ||= operator

2011-02-11 Thread Brian Fraser
It's the If $sheet->{MaxRow} is false[0], then the value of $sheet->{MinRow} is assigned to that variable; If it's true, nothing happens. Same deal with line 14; you canr ead more about the logical-or and other operators in perldoc perlop[1]. Brian. [0] http://perldoc.perl.org/perlsyn.html#Truth

Re: Script to prepend text to beginning of file

2011-01-21 Thread Brian Fraser
> > use strict; > use warnings; > use Tie::File; > > my @array; > tie @array, 'Tie::File', FILENAME or die "Couldn't open file: $!" > > unshift @array, <<'END_PREPEND'; > ENTHDR|1|3.0 > STAGEHDR|Barcoded > END_PREPEND > Haven't tested it, but it should work. http://perldoc.perl.org/Tie/File.html

Re: Windows 7 64 bit Make.exe file

2011-01-19 Thread Brian Fraser
On Wed, Jan 19, 2011 at 6:35 AM, Sean Murphy wrote: > Hi guys, > > thanks. I have removed Active PERL and now are using strawberry to do my > work. No problems with Strawberry and I can get rid of the MS C++ Express > 2010 compiler. > s/PERL/Perl/; http://perldoc.perl.org/perlfaq1.html#What%27s-t

Re: Smart matching

2011-01-18 Thread Brian Fraser
The smart match is no longer commutative - That was removed after 5.10.1, I think. http://www.learning-perl.com/?p=32 http://perldoc.perl.org/perlsyn.html#Smart-matching-in-detail Brian.

Re: Map function, what does it do?

2011-01-11 Thread Brian Fraser
Rob, I'm going to answer the middle part of your mail first, hopefully you won't mind: > On Tue, Jan 11, 2011 at 3:56 PM, Rob Dixon wrote: > The link you supply talks about recent versions of push, pop, etc. > working on array references as well as arrays, so that the code could > also be writt

Re: Map function, what does it do?

2011-01-11 Thread Brian Fraser
On Tue, Jan 11, 2011 at 10:19 AM, John W. Krahn wrote: > foreach (@arr) { > push @new, $_; > } > > Trying to use a scalar as the first argument to push will result in an > error message. > > Doesn't make the original any less wrong, but as an aside, that's no longer true on 5.13.7+ Perls. http:/

Re: removing hex characters from a file

2011-01-06 Thread Brian Fraser
If you still care to debug this, one more experiment: Try print "[$\]"; http://perldoc.perl.org/perlvar.html#$\ Brian.

Re: removing hex characters from a file

2011-01-05 Thread Brian Fraser
On Wed, Jan 5, 2011 at 10:50 PM, Brian Fraser wrote: > > On Wed, Jan 5, 2011 at 10:42 PM, jbiskofski wrote: > Brian, thanks for the quick reply. I apologize if its not the correct > etiquete to reply directly to you, this is the first time Ive had to > recur to the mailing lists

Re: default arguments in subroutine

2011-01-03 Thread Brian Fraser
> >How can I define default arguments in Perl subroutine? Can > anybody explain with examples? > Sure. But as per usual, there is more than one way to do it. This requires a Perl 5.10 or newer, for say[0] and the defined-or[1] operator; say can be replaced with a print and a trailing n

Re: [OT] The Happy, Happy, Feel Good Thread (WAS: New Document: "How to Start Contributing to or Using Open Source Software")

2011-01-01 Thread Brian Fraser
People. Go -f>@+?*<.-&'_:$#/%! yourselves. How about some more Perl, and a lot less fucking drama? At least be original (or copypaste from Stack Overflow[0]) and do this on topic, folks. By the way, happy new year! [0] http://stackoverflow.com/questions/234075/what-is-your-best-programmer-joke/2

Re: Perl Books

2010-12-28 Thread Brian Fraser
On Tue, Dec 28, 2010 at 11:22 PM, Shawn H Corey wrote: > Perl for System Administration, David N. Blank-Edelman, O'Reilly & > Associates, Inc. ISBN 1-56592-609-9 > > Since we are at it, would the first edition be preferable to the second (renamed Automating System Administration with Perl)[0]? Or

Re: given-when statement as a rvalue?

2010-12-26 Thread Brian Fraser
Your example actually works -- On perl 5.13.+: http://www.effectiveperlprogramming.com/blog/683 Brian.

Re: Writing 3D games with Perl... How's the Performance?

2010-12-24 Thread Brian Fraser
There's a SDL Perl book in the works[0], so that's a starting point, if anything. Also, it's not really what you ask, but check out this presentation of Lacuna Expanse[1]'s architecture. Unfortunately, those are all the games I know made in Perl. Brian. [0] https://github.com/PerlGameDev/SDL_Man

  1   2   >