Re: 3-argument open on STDIN

2011-08-23 Thread Bryan R Harris
>>>>>>>> "Bryan" == Bryan R Harris writes: >>> >>> Bryan> How can I use the "safe" 3-argument open and still be able to read >>> off >>> a >>> Bryan> pipe? >>> >>> You don'

Re: 3-argument open on STDIN

2011-08-22 Thread Bryan R Harris
>>>>>> "Bryan" == Bryan R Harris writes: > > Bryan> How can I use the "safe" 3-argument open and still be able to read off > a > Bryan> pipe? > > You don't. 2-arg open has to be good for something. > > And 2-arg

3-argument open on STDIN

2011-08-22 Thread Bryan R Harris
How can I do a 3-argument open on STDIN? This doesn't work because the 3-argument open won't open STDIN when you tell it to open "-". ** @files = ("-"); for (@files) { print reverse readfile($_); } sub readfile { open(my $fh,"<",$_[0]) or die "$me

3-argument open on STDIN

2011-08-17 Thread Bryan R Harris
How can I do a 3-argument open on STDIN? This doesn't work because the 3-argument open won't open STDIN when you tell it to open "-". ** @files = ("-"); for (@files) { print reverse readfile($_); } sub readfile { open(my $fh,"<",$_[0]) or die "$me

Re: matplotlib

2011-06-28 Thread Bryan R Harris
t;> some work at home and cannot afford the considerable cost to buy >>>> commercial packages for personal use. >>>> >>>> Wernher >>>> >>>> On Tue, Jun 28, 2011 at 6:58 PM, Wernher Eksteen >>>> wrote: >>>&g

matplotlib

2011-06-22 Thread Bryan R Harris
I much prefer perl to python given my recent forays into that language (python's regex is awful!), however it has an excellent plotting package that is very similar to matlab but supports things like marker alphas. It's called matplotlib, and requires scipy and numpy. PDL is the closest thing I

Re: Building an image one pixel at a time

2011-03-30 Thread Bryan R Harris
> On 11-03-30 11:36 AM, Bryan R Harris wrote: >> >> >> All, >> >> Is it possible to build an image one pixel at a time, e.g. to have a data >> structure that looks like this: >> >> $i{channel}[x][y] >> >> ... where channel is r,

Building an image one pixel at a time

2011-03-30 Thread Bryan R Harris
All, Is it possible to build an image one pixel at a time, e.g. to have a data structure that looks like this: $i{channel}[x][y] ... where channel is r,g,b, or a, and x and y are the pixel coordinates. Then, once I have the data filled out, call some module and write out a .png file? - Bryan

redirect STDERR

2010-11-02 Thread Bryan R Harris
I have these lines in my script: ** for my $handle (*STDIN, *STDERR) { open($handle, "+$outfile") or die "$me: Couldn't open $outfile: $!\n"; $| = 1; # and don't buffer it ** I decided I want STDERR to also be

unary not?

2010-07-15 Thread Bryan R Harris
Out of curiosity, is there a unary not operator in perl? i.e. "$a = $a+1" is the same as "$a++" Is there a similarly short form of "$a = !$a"? Like "$a!!"? (tried it and it didn't work.) - Bryan -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-m

Re: \1 in character class?

2010-07-14 Thread Bryan R Harris
Wow, an impressive set of responses -- thanks Erez, Chas, Chris, C., Shawn, and Jennifer. I think most of the response pointed to "non-greedy" matches, is that right? Are those deprecated or discouraged? Thanks again. - Bryan > On Wed, Jul 14, 2010 at 00:50, C.DeRykus wrote: > snip >>> s

\1 in character class?

2010-07-13 Thread Bryan R Harris
I'm trying to temporarily deal with simple quoted strings by turning: data: "this is a string" more: "this is another" into... data: "this is a string" more: "this is another" I thought this would work: s/(['"])([^\1]*)\1/${1}.despace($2).$1/gse; sub despace { my $t = shift;

Use of uninitialized value in print at...

2010-06-03 Thread Bryan R Harris
Seems like the first time I run a new script I *always* get an error message something like this: "Use of uninitialized value in printf at /Users/harrisb/Library/perl/matc line 414." The problem is usually I'm printing several things, so I have no idea which variable wasn't initialized from t

Re: append to a hash?

2010-05-20 Thread Bryan R Harris
>>>>>> "BRH" == Bryan R Harris writes: > > BRH> I have code that looks like this: > > BRH> ** > BRH> if ($props =~ /\S/) { > BRH> %{$ptr[-1]->[-1]} = ($props =~ m/\s*([^=]+)=&q

append to a hash?

2010-05-20 Thread Bryan R Harris
I have code that looks like this: ** if ($props =~ /\S/) { %{$ptr[-1]->[-1]} = ($props =~ m/\s*([^=]+)="([^"]+)"/g); } ** My problem is that I only want to append the properties and their values to that hash, not replac

Re: why on while?

2010-03-08 Thread Bryan R Harris
>>>>>> "BRH" == Bryan R Harris writes: > > BRH> Much to my chagrin I realized this morning that this notation: > > BRH> while() { > > BRH> evaluates as: > > BRH> while(defined($_ = )) { > > BRH> ..

why on while?

2010-03-08 Thread Bryan R Harris
Much to my chagrin I realized this morning that this notation: while() { evaluates as: while(defined($_ = )) { ... and NOT as: while(defined(local $_ = )) { I had a subroutine that was set up to read and parse a file, but it was trashing the value of $_ out in the main program!

anonymous hash slices

2010-02-24 Thread Bryan R Harris
Just as an academic exercise, I thought I should be able to do this: ** @a=(l=>35,k=>31,r=>7,k=>6); @r=qw/l r r k/; # make an anonymous hash using @a, then grab values from it using @r as keys @a...@a}{@r}; print join(",",@a), "\n"' ***

Re: octal?!

2010-02-22 Thread Bryan R Harris
> On Fri, Feb 19, 2010 at 10:34 PM, Bryan R Harris > wrote: >> >> >>> >>>> Is there any way to keep perl's eval from interpreting numbers starting >>>> with >>>> "0" as octal? >>> >>> Stringif

Re: octal?!

2010-02-21 Thread Bryan R Harris
> Thanks for not top-posting and for following E-mail netiquette. See below for > my response. Uh, sure. Most people don't get thanked for this, so I'm curious what prompted that. > On Sunday 21 Feb 2010 05:01:12 Bryan R Harris wrote: >>> On Saturday 20 Feb 2010 0

Re: octal?!

2010-02-21 Thread Bryan R Harris
> Bryan R Harris wrote: >> >>> Bryan R Harris wrote: >>>> This is unintuitive: >>>> >>>> perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}' >>>> >>>> ... t

Re: octal?!

2010-02-20 Thread Bryan R Harris
> On Saturday 20 Feb 2010 04:53:18 Bryan R Harris wrote: >> This is unintuitive: >> >> perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}' >> >> ... then enter 2*012. It prints "20". 2*12 is

Re: octal?!

2010-02-20 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> This is unintuitive: >> >> perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}' >> >> ... then enter 2*012. It prints "20". 2*12 is obviously 24, but perl&#

Re: octal?!

2010-02-19 Thread Bryan R Harris
> >> Is there any way to keep perl's eval from interpreting numbers starting >> with >> "0" as octal? > > Stringify them ? > 2 * '012' is 24. Manually? We could have thousands of them. How do I stringify them when they may potentially be in the middle of an expression? eg. 75+32*(15+052/3)

octal?!

2010-02-19 Thread Bryan R Harris
This is unintuitive: perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}' ... then enter 2*012. It prints "20". 2*12 is obviously 24, but perl's interpreting that "012" as octal. We sometimes have our numbers zero padded to make the columns line up, they're not octal. Is there

Re: being smart about script structure

2009-12-22 Thread Bryan R Harris
> Bryan R Harris wrote: > >>> perl -wle ' >>> >>> sub inc{ ++$_ for @_ } >>> >>> my @x = 1 .. 5; >>> >>> inc @x; >>> >>> print "@x"; >>> ' >>> 2

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> On Wed, 16 Dec 2009 17:47:16 -0600, Bryan R Harris wrote: >>> Okay, here's one I struggle with often -- is one of these better than >>> the other? >>> >>> ** >>> A. >>>

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> On Wed, 16 Dec 2009 17:47:16 -0600, Bryan R Harris wrote: >> Okay, here's one I struggle with often -- is one of these better than >> the other? >> >> ** >> A. >> if ( isFla

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> Wagner, David --- Senior Programmer Analyst --- CFS wrote: > >> You pass as a refernce as ni >> called_sub(\...@d); >> Now when you update, you are updating @d and not a copy. > > No need to use a reference for that: > > perl -wle ' > > sub inc{ ++$_ for @_ } > > my @x = 1 .. 5; >

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
>> What's the difference between pointers and references?  Where can I read >> about that difference? > > The key difference in my mind is this: Perl references are defined in > terms of perl datatypes. C pointers are defined (more or less) in > terms of memory locations. > > If you think about

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
>> Is there any way to make a new variable, @something, that is just another >> name for the array that was passed in by reference? Since I'm building a >> complex data structure, having to include all those @{}'s can get annoying. > > Elements of a hash referenced by $h can be accessed by $h->

Re: being smart about script structure

2009-12-16 Thread Bryan R Harris
>> No other perl programmers here, unfortunately.  Good advice, though. > > Why don't you post your ideas here for criticism then? I wouldn't post > an entire several hundred line script, but you could post your > specification and your plan for writing a code which met said > specification. If

Re: being smart about script structure

2009-12-16 Thread Bryan R Harris
A couple responses, mixed in below: > 2009/12/11 Bryan R Harris : >>>> Seems like a waste to do step 2 in a subroutine since we only do it once, >>>> but it does fill the main body of the script with code-noise that makes it >>>> harder to debug overall

Re: being smart about script structure

2009-12-16 Thread Bryan R Harris
[stuff cut out] >> For example, if I'm populating a complex variable @d with >> lots of pointers, >> hashes, arrays, etc. within, if I populate that within a >> subroutine, how do >> I get it back out conveniently without it making a whole >> nother copy of it >> outside? If it's 500 MB, isn't

Re: being smart about script structure

2009-12-11 Thread Bryan R Harris
>> Seems like a waste to do step 2 in a subroutine since we only do it once, >> but it does fill the main body of the script with code-noise that makes it >> harder to debug overall logic problems...  Not much logic here, but >> certainly in more complex scripts. > > A waste of what exactly? Yo

Re: being smart about script structure

2009-12-11 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> I'm not even sure how to ask this question, but here goes: >> >> I struggle knowing how to structure my code, what things belong as their own >> subroutines and what things can stay in the main script. How do the smart &g

being smart about script structure

2009-12-11 Thread Bryan R Harris
I'm not even sure how to ask this question, but here goes: I struggle knowing how to structure my code, what things belong as their own subroutines and what things can stay in the main script. How do the smart guys make these decisions? For example, let's say I need to: 1. Read a complex fil

On map

2009-11-10 Thread Bryan R Harris
I have a curiosity maybe someone here can help with. This code: @a=(1,2); map { $_ = 3 } @a; print join(",", @a), "\n"; ... prints "3,3". That map is changing the @a array as it goes through it. Good. Now this: %a=(1,2); map { $_ = 3 } keys %a; print join(",", keys(%a)), "

Re: printf with currency symbols

2009-10-26 Thread Bryan R Harris
> Robert Citek wrote: >> Not sure if there is a better way. My guess is that there is probably >> some module to convert float to currency and then print it as a >> string. But a quick Google didn't turn up anything. > > Here' why (extracted from `perldoc perllocale`): > >Category LC_MONET

printf with currency symbols

2009-10-26 Thread Bryan R Harris
Is there a good way to do printf's with currency symbols? I've tried this: printf "Total: \$%10.2f\n", $total; But it puts the dollar sign way out front (ugly). I want it to look like: Total:$24.15 Is there a way to do this without getting all messy like this? printf "Total:%10s\

compressed data embedded in script

2009-10-05 Thread Bryan R Harris
I have about 60 MB of text data I want to include at the bottom of a script. 60 MB is too big for us, but compressed it would be probably only 3-6 MB which is much better. Is there any way to put gzipped data in the DATA section of a script, and have the main body of the script conveniently re

Re: decimal to binary?

2009-09-23 Thread Bryan R Harris
>>>>>> "BRH" == Bryan R Harris writes: > > BRH> Maybe this is just my own ignorance on big-endian vs. little endian, > but > BRH> this code: > > BRH> print "big-endian: ", unpack("H*", pack("d"

Re: decimal to binary?

2009-09-23 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> I need to convert a number like this: -3205.0569059 >> ... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a bc 93 >> d3 (I just made up those 8 byte values). >> >> Is this easy in perl? Are long a

Re: decimal to binary?

2009-09-23 Thread Bryan R Harris
> From: Uri Guttman > >>>>>>> "BM" == Bob McConnell writes: >> >> BM> From: Bryan R Harris >>>> >>>> I need to convert a number like this: -3205.0569059 >>>> ... into an 8-byte double (big and li

Re: decimal to binary?

2009-09-23 Thread Bryan R Harris
>> I need to convert a number like this: -3205.0569059 >> ... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a > bc 93 >> d3 (I just made up those 8 byte values). >> >> Is this easy in perl? Are long and short ints easy as well? > > The sprintf() family is your friend. I

decimal to binary?

2009-09-23 Thread Bryan R Harris
I need to convert a number like this: -3205.0569059 ... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a bc 93 d3 (I just made up those 8 byte values). Is this easy in perl? Are long and short ints easy as well? Thanks! - Bryan -- To unsubscribe, e-mail: beginners-un

Re: Burnt Camel Club

2009-09-22 Thread Bryan R Harris
> On Mon, Sep 21, 2009 at 10:09 PM, Randal L. Schwartz > wrote: > >> >> Yup. I care when it might harm others. Otherwise, I tend not to >> talk... plenty of other people here to give answers. I only doublecheck >> answers anymore. >> > Yes, that is why this list gets 5 emails on average per

Re: best way to get number of elements in list value

2009-09-22 Thread Bryan R Harris
> On Tue, Sep 22, 2009 at 12:46:59PM +0400, Roman Makurin wrote: >> Hi All! >> >> right now im doing it in following way: >> >> $size = @{[func_that_return_list_value]}; >> >> is there any best way to do it ? > > $size =()= func_that_return_list_value; "goatse"? Can you explain how perl in

Re: "$| = 1" ???

2009-09-10 Thread Bryan R Harris
>>>>>> "BRH" == Bryan R Harris writes: > > BRH> Curiously the most helpful people on this list seem to think the > BRH> perldoc system is great, but I've always found it to be rather > BRH> hard to use. If I need to figure out what &

Re: "$| = 1" ???

2009-09-10 Thread Bryan R Harris
>> "ES" == Erez Schatz writes: > >>> $| is a special variable. All perl special variables are listed in >>> perldoc perlvar. See that document for a full explanation. > > ES> This isn't really helping, sorry. > > sorry, but pointing someone to the docs is helping more than directly > ans

execute in another terminal

2009-09-04 Thread Bryan R Harris
Not exactly a perl question, but I'd certainly like to use this with perl... Is it possible from one terminal window in linux (RH) to tell another terminal to execute a shell command, e.g. perl script, just as if you typed it there? - Bryan -- To unsubscribe, e-mail: beginners-unsubscr..

Re: ||= operator

2009-08-10 Thread Bryan R Harris
> Admin wrote: >> Shawn H. Corey wrote: >>> Admin wrote: Hi there, is there a page that explains the ||= operator and similar operators? google is not quite finding the special characters in the first 10 hits. >>> >>> See http://perldoc.perl.org/perlop.html#Assign

Re: two questions

2009-08-06 Thread Bryan R Harris
> On Thu, Aug 6, 2009 at 11:54, Bryan R Harris > wrote: > snip >> Now that's just impressive. >> >> For some reason the back of my brain thinks if I knew perl as well as you >> two seem to I could easily make all the money I wanted.  Just between you >

Comma operator

2009-08-06 Thread Bryan R Harris
A question about the comma operator: (John and Chas deserve a rest from my questions, if they want it =). The binary comma operator in scalar context supposedly "evaluates its left argument, throws that value away, then evaluates its right argument and returns that value." So this: $_ = "d

Re: two questions

2009-08-06 Thread Bryan R Harris
> On Thu, Aug 6, 2009 at 11:15, Bryan R Harris > wrote: >> >>>> According to the FAQ you want to do it like this: >>>> >>>> s/^\s+//, s/\s+$// for $var; >> >> >> I can't find documentation of this notation anywhere, i.e.

FW: two questions

2009-08-06 Thread Bryan R Harris
>> According to the FAQ you want to do it like this: >> >> s/^\s+//, s/\s+$// for $var; I can't find documentation of this notation anywhere, i.e. the comma between statements with a trailing for. John, where do you find all this cool stuff? - Bryan -- To unsubscribe, e-mail: beginner

Re: better readline?

2009-08-06 Thread Bryan R Harris
> On Wed, Aug 5, 2009 at 14:52, Bryan R Harris > wrote: > snip >> I didn't change anything, actually -- it never printed the "8/2 Updated >> database" string.  It prompted with the "Enter a date and note:", I typed >> "Uh." and that

Re: better readline?

2009-08-05 Thread Bryan R Harris
> On Tue, Aug 4, 2009 at 16:35, Bryan Harris wrote: > snip >>> while ( defined (my $answer = $term->readline("Enter a date and >>> note:", "8/2 Updated database")) ) { >>> print "you said $answer\n"; >>> } >> >> >> Thanks for the response Chas -- oddly it doesn't work.  This is what it >> print

better readline?

2009-08-03 Thread Bryan R Harris
I'm writing a little script where the user enters some data via keyboard. The script in some cases can guess what the user will want to enter, but I'd like the user to be able to override what the computer has guessed. For example, the computer thinks the user will enter "8/2 Updated database",

Re: On using $_ in subroutines

2009-07-29 Thread Bryan R Harris
> Bryan R Harris wrote: >>> Bryan Harris wrote: >>>> John W. Krahn wrote: >>>>> Bryan Harris wrote: >>>>>> ... but by modifying $_ I was clobbering $_ elsewhere in the larger >>>>>> program! >>>>> Yes b

Re: On using $_ in subroutines

2009-07-28 Thread Bryan R Harris
> On Mon, Jul 27, 2009 at 09:49, Bryan Harris wrote: > snip >>> Yes because $_ is a special global variable.  This effect is called >>> "action at a distance" which is why it is better to use named lexically >>> scoped variables instead of $_. >> >> I have the Perl Bookshelf on CD (and perldoc,

Re: On using $_ in subroutines

2009-07-28 Thread Bryan R Harris
> Bryan Harris wrote: >> >> John W. Krahn wrote: >>> >>> Bryan Harris wrote: ... but by modifying $_ I was clobbering $_ elsewhere in the larger program! >>> Yes because $_ is a special global variable. This effect is called >>> "action at a distance" which is why it is better t

Re: evaluate for max and min value in array

2009-07-22 Thread Bryan R Harris
> You can fing max and min value as, > > my @ar = (1,2,3,4,58,9,2,1); > my $max = (sort { $b <=> $a } @ar)[0]; > my $min = (sort { $a <=> $b } @ar)[0]; If your arrays could be very large, it's a waste of cycles to sort the list then throw most of that effort away. You could do: **

Re: match and putting in a variable with a single statement

2008-10-24 Thread Bryan R Harris
> On Fri, Oct 24, 2008 at 8:42 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: >> >> >> On Oct 24, 2008, at 11:00, "Sharan Basappa" <[EMAIL PROTECTED]> >> wrote: >> >>> Hi, >>> >>> I was just trying to match a string and save it in a single statement >>> as follows: >>> >>> $extracted = "cp xyz";

Re: get function name?

2008-10-01 Thread Bryan R Harris
>> Is it possible from within a function to get the name of the function I'm >> in? e.g. >> >> ** >> sub function23 { return "I am in function $\n"; } >> >> print function23(); >> ** >> >> ... should return "I am in funct

get function name?

2008-10-01 Thread Bryan R Harris
Is it possible from within a function to get the name of the function I'm in? e.g. ** sub function23 { return "I am in function $\n"; } print function23(); ** ... should return "I am in function function23" Does that mak

talking to an IMAP server with perl

2008-09-11 Thread Bryan R Harris
I have a weird problem with our Lotus Notes IMAP server -- certain spam messages cause our email clients to not download that message, nor any subsequent ones. So I thought I'd write a perl script that I could run that would go onto the IMAP server and look for messages with the specific traits

Re: encrypt a text file

2008-08-27 Thread Bryan R Harris
> hello, > > how to encrypt a text file and decrypt it with perl? > > for example, I have a config file, > > svr.conf > > I want to encrypt it to svr.conf.encrypt. > > But I should also have the ability to decrypt the encryped one to the > original text. > > Any suggestion is welcome. than

Re: populating a hash slice from a filehandle

2008-06-23 Thread Bryan R Harris
> From: Bryan R Harris <[EMAIL PROTECTED]> >>> Bryan R Harris wrote: >>>> >>>> John W. Krahn wrote: >>>>> >>>>> Bryan R Harris wrote: >>>>>> >>>>>> John W. Krahn wrote: >>>>

Re: populating a hash slice from a filehandle

2008-06-20 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> John W. Krahn wrote: >>> >>> Bryan R Harris wrote: >>>> >>>> John W. Krahn wrote: >>>>> >>>>> The left hand side of the assignment determines context so the @l2r{...} >>

Re: populating a hash slice from a filehandle

2008-06-20 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> John W. Krahn wrote: >>> >>> Bryan R Harris wrote: >>>> >>>>> Jenda Krynicky wrote: >>>>> >>>>> Context. The returns a single line in scalar context and >>>&g

Re: populating a hash slice from a filehandle

2008-06-19 Thread Bryan R Harris
> Bryan R Harris wrote: >>> From: Bryan R Harris <[EMAIL PROTECTED]> >>>> Given an open filehandle, why don't these two things do the same thing? >>>> >>>> ** >>>> @l2r{"a","

Re: populating a hash slice from a filehandle

2008-06-19 Thread Bryan R Harris
> From: Bryan R Harris <[EMAIL PROTECTED]> >> Given an open filehandle, why don't these two things do the same thing? >> >> ** >> @l2r{"a","b"} = (, ); >> $c = ; >> >> **

populating a hash slice from a filehandle

2008-06-18 Thread Bryan R Harris
Given an open filehandle, why don't these two things do the same thing? ** @l2r{"a","b"} = (, ); $c = ; ** $l2r{"a"} = ; $l2r{"b"} = ; $c = ; ** The first seems to be slurping the whole

Re: Postponing variable replacement

2008-01-23 Thread Bryan R Harris
>> Is there any way to change the last statement to do what I want, which in >> this case is print "perl is cool"? [stuff cut out] > (my $new_message = $message) =~ s/\$(\w+)/$includes{$1}/g; [stuff cut out] Um, I guess... I was more curious if there wasn't something like: print "\S$b

Postponing variable replacement

2008-01-23 Thread Bryan R Harris
Is there any way to change the last statement to do what I want, which in this case is print "perl is cool"? ** $a='$b is cool'; ... bunch of stuff here... $b = "perl"; print $a, "\n";' ** Thanks! - Bryan -- To uns

Re: how do I use a module without installing it?

2007-05-15 Thread Bryan R Harris
Ah, got it all figured out -- it works! Thanks Andrew and Chas for your help! - Bryan >> On 5/15/07, Bryan R Harris <[EMAIL PROTECTED]> wrote: >> snip >>> >>> It worked! Sort of... >>> >>> According to the camel book, "use li

Re: how do I use a module without installing it?

2007-05-15 Thread Bryan R Harris
> On 5/15/07, Bryan R Harris <[EMAIL PROTECTED]> wrote: > snip >> >> It worked! Sort of... >> >> According to the camel book, "use lib" looks for "$dir/$archname/auto", but >> $archname isn't defined and I don't know wha

Re: how do I use a module without installing it?

2007-05-15 Thread Bryan R Harris
> Bryan R Harris: >> >> I'd love to use the Curses module for an upcoming script, but I don't have >> root on the machines it will be used on. Is it possible to use the module >> without installing it? >> > > From perldoc, >

Re: how do I use a module without installing it?

2007-05-15 Thread Bryan R Harris
> On 5/15/07, Bryan R Harris <[EMAIL PROTECTED]> wrote: >> >> >> I'd love to use the Curses module for an upcoming script, but I don't have >> root on the machines it will be used on. Is it possible to use the module >> without installing it?

how do I use a module without installing it?

2007-05-15 Thread Bryan R Harris
I'd love to use the Curses module for an upcoming script, but I don't have root on the machines it will be used on. Is it possible to use the module without installing it? If so, how is it done? TIA, - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: How to determine content type of a variable

2007-04-19 Thread Bryan R Harris
ds on the type of thing the reference is a reference to. > Builtin types include: > > On 4/19/07, Bryan R Harris <[EMAIL PROTECTED]> wrote: >> >> >> Is there a way to determine whether a variable is a pointer to a hash, >> pointer to an array, or just a

How to determine content type of a variable

2007-04-19 Thread Bryan R Harris
Is there a way to determine whether a variable is a pointer to a hash, pointer to an array, or just a number/string? TIA. - Bryan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: All of "perldoc" to text

2006-11-02 Thread Bryan R Harris
> On 11/1/06, Bryan R Harris <[EMAIL PROTECTED]> wrote: > >> "perldoc" to me has always been this kind of magicians hat where you >> wave a wand and chant some special words and magically out pops >> some thing you never read or heard before. > >&g

All of "perldoc" to text

2006-11-01 Thread Bryan R Harris
"perldoc" to me has always been this kind of magicians hat where you wave a wand and chant some special words and magically out pops some thing you never read or heard before. Also surprising is how detailed it is, it seems to have things that even the Perl Bookshelf doesn't. Is it possible to

Re: Is that I can do something like that ?

2006-10-26 Thread Bryan R Harris
> Bryan R Harris wrote: >> >>>> 2) perl -le '$x = qw/a b c d e/; print $x' >>>> e >>>> Or better what is (2) doing? >>> Read up on the comma operator in perlop (and I know there are no literal >>> commas in (2)

Re: Is that I can do something like that ?

2006-10-25 Thread Bryan R Harris
>> 2) perl -le '$x = qw/a b c d e/; print $x' >> e > >> Or better what is (2) doing? > > Read up on the comma operator in perlop (and I know there are no literal > commas in (2) but qw/a b c d e/ behaves exactly the same as ('a', 'b', 'c', > 'd', 'e').) > > perldoc perlop Why would this be c

Re: Is that I can do something like that ?

2006-10-25 Thread Bryan R Harris
> D. Bolliger wrote: >> Mug am Mittwoch, 25. Oktober 2006 13:12: >> >>> I don't know if that anyway I can know what should I pass back >>> from right hand side to left hand side, like : >>> >>> my $x = qw/a b c d e / ; # so I have $x = 5 >> >> The list on the right hand side is evaluated in sc

Re: getting a 2 digit readout no matter what

2006-10-04 Thread Bryan R Harris
> Hello all. Trying to get a 2 digit readout from $hour pulled from > localtime. How can I do this? > > This is running on a sun box, so I also tried pulling from: > $string = system "date"; but if one digit, it will not put a "0" in front. > > But this doesn't only seems to assign "0". And

Re: Smart assignment

2006-10-03 Thread Bryan R Harris
> Bryan R Harris wrote: >> >>>> returns "true" or "false" (1 or '') and in list context it returns the >>>> contents of any capturing parentheses in the pattern. >>>> >>>> The expression: >>>>

Re: Smart assignment

2006-10-03 Thread Bryan R Harris
>> returns "true" or "false" (1 or '') and in list context it returns the >> contents of any capturing parentheses in the pattern. >> >> The expression: >> >> ( $ptypeline =~ /movable.+(sine|geo|radial|ortho)/i >> )[ 0 ] >> >> is a list slice so the regular expression is in list context but th

Re: Smart assignment

2006-10-03 Thread Bryan R Harris
> Jen Spinney wrote: >> On 10/2/06, Mumia W. <[EMAIL PROTECTED]> wrote: >>> >>> Yes, and here is another way: >>> >>> $ptype = (($ptypeline =~ /movable.+(sine|geo|radial|ortho)/i)[0]) || >>> '(missing)'; >> >> How does that way work? I was curious, so I tested it myself and it >> clearly did

Smart assignment

2006-10-02 Thread Bryan R Harris
** $ptypeline = "#movableortProjortho0.0000.000"; ($ptype) = ($ptypeline =~ /movable.+(sine|geo|radial|ortho)/i) || "(missing)"; print $ptype, "\n"; ** The above code prints "1", where I want it to

Re: Standard input errors

2006-09-26 Thread Bryan R Harris
And an extra double quote on your "enter your address" line. - B > Here are my error: > > > [EMAIL PROTECTED] ~]$ perl hello.pl > String found where operator expected at hello.pl line > 15, near "print "" > (Might be a runaway multi-line "" string starting on > line 11) > (Missing

Re: Standard input errors

2006-09-26 Thread Bryan R Harris
Missing semicolon after "my $address"? - B > > > Here are my error: > > > [EMAIL PROTECTED] ~]$ perl hello.pl > String found where operator expected at hello.pl line > 15, near "print "" > (Might be a runaway multi-line "" string starting on > line 11) > (Missing semicolon on pre

Re: Standard input Question

2006-09-26 Thread Bryan R Harris
>>> If i going to write a script with a standard input how would it look like?My >>> perl book don't talk about it. >> >> What book? And what part thereof did you read? >> (Besides the cover, that >> is...) > > Learning perl and programming perl book First look up the "diamond" operator ("<>")

Re: getting columns of 2D array

2006-09-22 Thread Bryan R Harris
> Aditi Gupta wrote: >> Hello Everybody, > > Hello, > >> We can get rows of a 2D array as >> >> $aref = $AoA[$i]; >> print @$aref; #will print row 'i' as an array >> >> How can I print column 'i' as an array using references? Is there any >> other way which doesn't require two 'for loops' to

Re: bizarre fractional exponents math

2006-09-15 Thread Bryan R Harris
do it, but I really need to remember those things. This list is awesome. - Bryan > Bryan R Harris wrote: >> >> Can someone explain this behavior? >> >> % perl -e 'print -12.17**0.2, "\n"' >> -1.64838295714428 > > This means >

bizarre fractional exponents math

2006-09-14 Thread Bryan R Harris
Can someone explain this behavior? % perl -e 'print -12.17**0.2, "\n"' -1.64838295714428 % perl -e 'print (-12.17)**(0.2), "\n"' -12.17% perl -e 'print ((-12.17)**(0.2)), "\n"' nan% Yes, the "\n" isn't getting printed for some reason on the 2nd two examples. Bottom line: -12.17**0.2 ==> -1.6

Re: defaults

2006-06-07 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> Can someone explain what: >> >> $pi ||= 3; >> >> ...means? I just saw it in Programming Perl (pp 540), but it doesn't >> explain it. Thx! > > || is the logical OR operator (see perldoc perlop) which says

  1   2   3   >