Re: confused by use of 'implied' variable

2013-04-05 Thread will trillich
> > as opposed to what i would have normally done ($aggregated_file_contents > .= $data;) > > yes, i know i can simply try it, to see if it works - but is there a more > general rule one can follow that tells them when this kind of thing can > normally be used, versus when not? &g

Re: perl pattern match option 's' (coerce . to include \n)

2012-03-08 Thread will trillich
Greg -- When you're looking for something in particular, it's easy to just look for that specific thing. As you say, Perl has different definitions of what "\n" actually translates to depending on platform and context. So rather than worry about "\n" just have Perl look for what you're actually lo

Re: pattern match 'or' operator |

2012-03-08 Thread will trillich
Greg -- The pipe | operator isn't single characters only: $string =~ /this|that|the other/; But the character set is: $string =~ /[abc]/; # matches any a, b or c $string =~ /[tw]hat/; # matches 'that' or 'what' What you're looking for is something like this: $string =~ /\\L(ength)?\b/; That'

Re: How to push a hash on to a hash of array entries

2011-11-08 Thread will trillich
On Tue, Nov 8, 2011 at 11:20 AM, Paul Rousseau wrote: > Here is the Dumper output when I use the code, > > push @{$project{$projectno}}, \%days; > Right, so $project{$projectno} is an ARRAYREF, and each entry pushed in this way will be a HASHREF. Note that other entries may exist in your array b

Re: How to split up a string with carriage returns into an array

2011-11-04 Thread will trillich
On Fri, Nov 4, 2011 at 1:15 PM, wrote: > Perl should handle the \r\n part for you - "\n" is normally a match for > whatever your OS's end of line marker is. > But just in case you're on *nix and processing a Windo~1 file, split( /[\r\n]+/, $msg ) is reasonably bullet-proof for breaking a string

Re: How to Extract a Date from a File

2011-11-02 Thread will trillich
How about something like this: next unless m:(\d\d\d\d)/(\d\d)/(\d\d):; $start_date = "$1$2$3"; On Wed, Nov 2, 2011 at 4:07 PM, Paul Rousseau wrote: > Hello Perl folks, > > > I would like to know if there is an eloquent way of extracting a date > string from a file. > > My code goes like t

Re: Help with file redirect

2011-07-05 Thread will trillich
I haven't tested this, but here's a similar problem to yours--maybe these solutions will work for you: http://www.perlmonks.org/?node_id=4913 On Tue, Jul 5, 2011 at 3:43 PM, Barry Brevik wrote: > I am writing an app that has a lot of screen output which it writes to > STDERR. > > The screen out

Re: how to best convert an array containing hexadecimal values to ascii value?

2010-11-23 Thread will trillich
Or if you want the characters themselves: @result = map { chr( hex ) } @source; Or as a solid string: $s = join '', map { chr( hex ) } @source; On Tue, Nov 23, 2010 at 3:47 PM, will trillich wrote: > Dude! This one is really easy: > > print hex("ff"); # 2

Re: how to best convert an array containing hexadecimal values to ascii value?

2010-11-23 Thread will trillich
Dude! This one is really easy: print hex("ff"); # 255! so @result = map{ hex } @source; Mwa ha ha! On Tue, Nov 23, 2010 at 3:44 PM, Greg Aiken wrote: > if one dumps a windows registry section using regedit (to *.reg format) > > > > the reg_sz values are listed in the following format (heres

Re: lame question "\\\\.\\pipe\\pipename" vs '\\.\pipe\pipename'

2010-10-20 Thread will trillich
Here's my take: print 'it\'s time \\ to go'; The backslash can quote the single-quote, and hence another backslash as well for completeness, within a single-quoted string. On Wed, Oct 20, 2010 at 12:09 PM, Greg Aiken wrote: > forgive my ignorance here, but I thought single quoted, or apostro