Re: Clear a hash

2008-01-18 Thread Aaron Priven
, TX 78227 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- Aaron Priven, [EMAIL PROTECTED],com, http://www.priven.com/aaron

Re: Variable division, assignment and sprintf in one line

2007-11-28 Thread Aaron Priven
$a_really_long_variable_name\n; $_ = sprintf (%.2f, (($_ /=1024) /=1024)) for $a_really_long_variable_name; print $a_really_long_variable_name\n; Both give the same output: 104857600 100.00 The latter is most useful if you really are iterating over a list, of course. -- Aaron Priven, [EMAIL

dereferencing

2007-10-29 Thread Aaron Priven
$hash{a}; that prints 5. But there's no way to do this with a lexical (my) variable. is this right? -- Aaron Priven, [EMAIL PROTECTED],com, http://www.priven.com/aaron

Re: dereferencing

2007-10-29 Thread Aaron Priven
to. Yay. -- Aaron Priven, [EMAIL PROTECTED], http://www.priven.com/aaron -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: dereferencing

2007-10-29 Thread Aaron Priven
the trick. -- Aaron Priven, [EMAIL PROTECTED], http://www.priven.com/aaron -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Bad scoping? Bad prototyping?

2006-10-09 Thread Aaron Priven
On Oct 9, 2006, at 10:35 AM, Helliwell, Kim wrote: #!/bin/perl sub1(Hello, ); sub1(world\n); sub sub2($str) { print $str; } sub sub1($str) { sub2($str) } Prototyping in perl does not do what you think it does. It does not turn your arguments into variables. All it does is

Re: Polluting the Global Namespace

2006-07-20 Thread Aaron Priven
See perldoc Exporter. If you use @EXPORT instead of @EXPORT_OK, it will put those subroutines into the global namespace by default. On Jul 20, 2006, at 3:09 AM, Shane Calimlim wrote: I'd like to add some sub routines to the global namespace. I know this is usually considered bad design for

Re: how to add a list of numbers

2006-07-15 Thread Aaron Priven
shortest way to add a list of random numbers ? for example : 11 1 250 39 100 , thanks -- ibiokid -- Aaron Priven, [EMAIL PROTECTED], http://www.priven.com/aaron -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http

Re: math formula substitution and evaluation

2006-07-15 Thread Aaron Priven
in some circumstances, bad in others. -- Aaron Priven, [EMAIL PROTECTED], http://www.priven.com/aaron -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: How to get the OS local/default drive using perl?

2006-07-13 Thread Aaron Priven
For a temporary file, you'd want to use the File::Temp module (see http://search.cpan.org/~tjenness/File-Temp-0.16/Temp.pm ). For a permanent file, such as a configuration file, you'd probably have to figure it out for each operating system, and then test $^O to figure out which operating

Re: regex repetition

2006-07-12 Thread Aaron Priven
Check out the module Set::IntSpan and see if it does what you want. http://search.cpan.org/dist/Set-IntSpan/IntSpan.pm On Jul 12, 2006, at 3:08 PM, Ryan Moszynski wrote: I need to write some code to allow users to specify which of a whole bunch of elements(e.g.512/1024) that they want to

... is a valid filename

2006-07-10 Thread Aaron Priven
For what it's worth, ... is indeed a valid filename. Back in Ancient Days of Yore, when I was a young undergrad at UC Santa Cruz playing on the open-access timeshare Unix system, we all had read access to each others' home directories, and it was somewhat common for people to put

Re: passing by value vs. passing by reference

2006-07-04 Thread Aaron Priven
is that I need $dir intact (ie unchopped) after calling said subroutine, but it has been altered by the chop. -- Aaron Priven, [EMAIL PROTECTED], http://www.priven.com/aaron -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http

Re: passing by value vs. passing by reference

2006-07-04 Thread Aaron Priven
On Jul 4, 2006, at 10:46 AM, Aaron Priven wrote: you could pass it an expression that returns the value of $a. Sorry, I should have said your variable instead of $a here. -- Aaron Priven, [EMAIL PROTECTED], http://www.priven.com/aaron -- To unsubscribe, e-mail: [EMAIL PROTECTED