$self

2004-02-19 Thread Jacob Chapa
is $self a special scalar? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Self Def

2001-06-19 Thread Nick Transier
Given that I am trying to define an object attribute which is an array of references to other object of the same type, how do I define this in the $self portion of my sub new constructor? This is what I have, will this work? Next is meant to hold an array of pointers or references. sub new

$self def

2001-06-20 Thread Nick Transier
Given this is my definition for self in some new constructor: sub new { $self { Next => @[Max_Level], } } First, is this the proper way to have Next be a reference to an annonymous array of size Max_Level? More importantly, how do you reference the elements in

Re: $self

2004-02-19 Thread WilliamGunther
No. $self you'll usually see in a lot of Object Oriented applications. When a subroutine is called using the -> operator ($mw = MainWindow->new, for example) the first arguement passed to that subroutine is the name of the package/class. So, $self is usually used to display this. S

RE: $self

2004-02-19 Thread Ohad Ohad
No, but it's a cool convention From: Jacob Chapa <[EMAIL PROTECTED]> To: Perl Beginners <[EMAIL PROTECTED]> Subject: $self Date: Thu, 19 Feb 2004 22:23:14 -0600 is $self a special scalar? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: $self

2004-02-20 Thread Wiggins d Anconia
Please bottom post > > No. $self you'll usually see in a lot of Object Oriented applications. When a > subroutine is called using the -> operator ($mw = MainWindow->new, for > example) the first arguement passed to that subroutine is the name of the > package/c

Re: $self

2004-02-20 Thread drieux
On Feb 19, 2004, at 8:45 PM, Ohad Ohad wrote: No, but it's a cool convention From: Jacob Chapa <[EMAIL PROTECTED]> To: Perl Beginners <[EMAIL PROTECTED]> Subject: $self Date: Thu, 19 Feb 2004 22:23:14 -0600 is $self a special scalar? actually the simpler solutions is

Re: $self

2004-02-20 Thread R. Joseph Newton
[EMAIL PROTECTED] wrote: > No. $self you'll usually see in a lot of Object Oriented applications. When a > subroutine is called using the -> operator ($mw = MainWindow->new, for > example) the first arguement passed to that subroutine is the name of the > package/class. So

Re: $self

2004-02-20 Thread R. Joseph Newton
> drieux wrote: > >> but I am fond of 'my $me' > No, no! Then you'd have to have ", $me $mine;" tacked onto the end to catchy the meter, and that wouldn't be sytactically correct. ( ;-p) Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: $self

2004-02-21 Thread David le Blanc
Would that be ( $me, my$self ) = &I ? sorry. > >> is $self a special scalar? > > actually the simpler solutions is > > sub my_do_foo > { > my ($me, $arg, $other) = @_; > > $me->doOther($arg) unless $other ; >

self Introduction

2015-08-10 Thread Angela L
Hello, I am a student from cameroon looking foward in doing the opw internship. I am new to perl and i wish to have some directives on how to get a grip of the code base and also contribute to the perl community. Thanks Angela L.

self-appending code

2001-04-28 Thread an_dy
I created a first simple program to append code to itself (script below). Is there a way to get that code interpreted in the same execution? That didn't happen, but when I started it a second time, the first appended text was interpreted, the second again not. main code filename: prg2.pl print"p

Re: Self Def

2001-06-19 Thread Randal L. Schwartz
>>>>> "Nick" == Nick Transier <[EMAIL PROTECTED]> writes: Nick> Given that I am trying to define an object attribute which is an array Nick> of references to other object of the same type, how do I define this Nick> in the $self portion of my sub new cons

Re: Self Def

2001-06-19 Thread Nick Transier
The thing is, I want to set the array reference later and not when the object is being created. >From: [EMAIL PROTECTED] (Randal L. Schwartz) >To: "Nick Transier" <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] >Subject: Re: Self Def >Date: 19 Jun 2001 14:12:13

Re: Self Def

2001-06-19 Thread Chas Owens
On 19 Jun 2001 16:02:43 -0500, Nick Transier wrote: > Given that I am trying to define an object attribute which is an array of > references to other object of the same type, how do I define this in the > $self portion of my sub new constructor? This is what I have, will this > w

Re: Self Def

2001-06-19 Thread Randal L. Schwartz
> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes: Chas> sub new { Chas> my $class = shift; Chas> $class= ref($class) || $class; PLEASE stop doing this. I know there's a Very Popular Tutorial included with your documentation that says that's a Right Way of doing it, but

Re: Self Def

2001-06-19 Thread Chas Owens
Well, in this case it was a cargo cultism. I understand why one may want to do this, but that was not my intent when I was writing this; I just grabbed an example constructor. I should have thought about the choice to make "new" a function that could be called by both the class and the object, b

Re: $self def

2001-06-20 Thread Randal L. Schwartz
>>>>> "Nick" == Nick Transier <[EMAIL PROTECTED]> writes: Nick> Given this is my definition for self in some new constructor: Nick> sub new { Nick>$self { Nick> Next => @[Max_Level], Nick>} Nick> } Nick> First

Re: $self def

2001-06-20 Thread Nick Transier
So then would I access the nth element by @{$self->{Next}}[n] ?? >From: [EMAIL PROTECTED] (Randal L. Schwartz) >To: "Nick Transier" <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] >Subject: Re: $self def >Date: 20 Jun 2001 09:29:41 -0700 > > >>>>

RE: $self def

2001-06-20 Thread Nick Transier
You are saying I cannot set the size of an array? I understand that you do not have to, but I need to in this case so that my iteration loops work correctly. >From: John Edwards <[EMAIL PROTECTED]> >To: 'Nick Transier' <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >Su

Re: $self def

2001-06-20 Thread Randal L. Schwartz
>>>>> "Nick" == Nick Transier <[EMAIL PROTECTED]> writes: Nick> So then would I access the nth element by Nick> @{$self->{Next}}[n] ?? Uh, no. That looks like @foo[3], which works for some broken values of "works". You want $foo[3], so

RE: $self def

2001-06-20 Thread Brett W. McCoy
On Wed, 20 Jun 2001, Nick Transier wrote: > You are saying I cannot set the size of an array? I understand that you do > not have to, but I need to in this case so that my iteration loops work > correctly. No you don't: foreach $i (0..@array) { print "$array[$i]\n"; } @array used in a

Re: $self def

2001-06-20 Thread Brett W. McCoy
On 20 Jun 2001, Randal L. Schwartz wrote: > The problem with references is that they have a very hard to explain > but completely intuitive interface. :) Gee, just like pointers in C! :-) -- Brett http://www.chapelperilous.net/btfwk/ --

Re: $self def

2001-06-20 Thread Randal L. Schwartz
> "Brett" == Brett W McCoy <[EMAIL PROTECTED]> writes: Brett> On Wed, 20 Jun 2001, Nick Transier wrote: >> You are saying I cannot set the size of an array? I understand that you do >> not have to, but I need to in this case so that my iteration loops work >> correctly. Brett> No you don't:

RE: $self def

2001-06-20 Thread John Edwards
Are you trying to use a hash?? --- @myArray = qw(one two three four); &new; sub new { $self{'Next'} = \@myArray; } print "Element 0 is $self{'Next'}->[0]\n"; --- You can't specifiy the size of the array, it's dynamic. Just enter y

Self referencing hash

2008-08-11 Thread Dermot
Hi, I am trying to make hash that refers to itself like this my %_HASH; %_HASH = ( typeOne => { root => '/path/to/typeOne', logfile => $_HASH{typeOne}->{root}.'/logone.log'; }, typeTwo => { root => '/path/to/typeTwo', logfile => $_HASH{typeTwo}->{root}.'/

bless $self, $class;

2006-02-17 Thread Ken Perl
what does the statement mean? bless $self, $class; -- perl -e 'print unpack(u,"62V5N\"FME;G\!Ehttp://learn.perl.org/> <http://learn.perl.org/first-response>

Re: self Introduction

2015-08-10 Thread Shlomi Fish
Hi Angela, On Mon, 10 Aug 2015 13:18:12 +0100 Angela L wrote: > Hello, I am a student from cameroon looking foward in doing the opw > internship. I am new to perl and i wish to have some directives on how to > get a grip of the code base and also contribute to the perl community. Welcome aboard

Re: self Introduction

2015-08-10 Thread Brandon McCaig
Angela: Hello, On Mon, Aug 10, 2015 at 01:18:12PM +0100, Angela L wrote: > Hello, I am a student from cameroon looking foward in doing the > opw internship. I am new to perl and i wish to have some > directives on how to get a grip of the code base and also > contribute to the perl community. I'

Re: self Introduction

2015-08-10 Thread Brandon McCaig
On Mon, Aug 10, 2015 at 10:41:12AM -0400, Brandon McCaig wrote: > I'm afraid that I'm not familiar with OWP so please forgive my > ignorance. Errr, OPW*. Regards, -- Brandon McCaig Castopulence Software Blog perl -E '$_=q{V zrna gur or

Re: self-appending code

2001-04-28 Thread Paul Cotter
Have a look at eval. You can build up your command string and execute it. The only difference is the scoping of the variables. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, 28 April, 2001 11:45 AM Subject: self-appending code > I

Re: self-appending code

2001-04-30 Thread Paul
--- [EMAIL PROTECTED] wrote: > I created a first simple program to append code to itself (script > below). Is there a way to get that code interpreted in the same > execution? That didn't happen, but when I started it a second time, > the first appended text was interpreted, the second again not.

what is $self->verbose

2002-10-09 Thread stanley
from some modules,i found this expression " if ($self->verbose) ". is this verbose is a special method or something else? thanks - Do you Yahoo!? Faith Hill - Exclusive Performances, Videos, & more faith.yahoo.com

Locatiing Self-Installed Modules

2004-03-22 Thread Ron Goral
Hello - I have a series of scripts and modules that I will self install, creating directories within the cgi-bin directory. The structure looks like this: |-- Base cgi-bin -- DsgnGrp --| |-- Utilities DsgnGrp contains the scripts that call

Re: Self referencing hash

2008-08-11 Thread Mr. Shawn H. Corey
On Mon, 2008-08-11 at 14:52 +0100, Dermot wrote: > Hi, > > I am trying to make hash that refers to itself like this > > my %_HASH; > %_HASH = ( >typeOne => { > root => '/path/to/typeOne', > logfile => $_HASH{typeOne}->{root}.'/logone.log'; > }, >typeTwo => { >

Re: Self referencing hash

2008-08-11 Thread yitzle
Not the way you are doing it. This would work, though: my %_HASH; %_HASH = ( typeOne => { root => '/path/to/typeOne', logfile => $_HASH{typeOne}->{root}.'/logone.log'; }, typeTwo => { root => '/path/to/typeTwo', logfile => $_HASH{typeTwo}->{root}.'/logtwo.l

Re: Self referencing hash

2008-08-11 Thread Rob Dixon
yitzle wrote: > On Mon, Aug 11, 2008 at 9:52 AM, Dermot <[EMAIL PROTECTED]> wrote: >> >> I am trying to make hash that refers to itself like this >> >> my %_HASH; >> %_HASH = ( >> typeOne => { >> root => '/path/to/typeOne', >> logfile => $_HASH{typeOne}->{root}.'/logone.log'; >>

Re: Self referencing hash

2008-08-11 Thread yitzle
On Mon, Aug 11, 2008 at 11:40 AM, Rob Dixon <[EMAIL PROTECTED]> wrote: > yitzle wrote: >> On Mon, Aug 11, 2008 at 9:52 AM, Dermot <[EMAIL PROTECTED]> wrote: >>> >>> I am trying to make hash that refers to itself like this >>> >>> my %_HASH; >>> %_HASH = ( >>> typeOne => { >>> root => '/pa

Re: Self referencing hash

2008-08-11 Thread Dermot
on were my balls-up :-/ Yes Rob I am trying to do some OO. It might make sense for what I'm after (upload different type of data to a remote server). I am making my way but I think I'll be using the list a bit over the next few days. I think I have harnessed some auto vivification as per

Re: Self referencing hash

2008-08-11 Thread Rob Dixon
; and setting out? > > TiA, > Dp. > > > my %_HASH = ( > typeOne => { > root => '/path/to/typeOne', > }, > typeTwo => { > root => '/path/to/typeTwo', > } >

Re: Self referencing hash

2008-08-11 Thread Mr. Shawn H. Corey
On Mon, 2008-08-11 at 20:28 +0100, Rob Dixon wrote: > - To answer your question, yes it's a good idea to write accessor methods like > type so that they will both read and write a value. But I would guess that you > shouldn't be able to modify an object's type once it has been created? There is mu

Re: Self referencing hash

2008-08-11 Thread Dermot
et) $self's type (EG: typeOne, >> typeTwo...etc) or set $self's type. Or should I separate the getting >> and setting out? >> >> TiA, >> Dp. >> >> >> my %_HASH = ( >> typeOne => { >> root => &#

Re: Self referencing hash

2008-08-12 Thread Mr. Shawn H. Corey
On Tue, 2008-08-12 at 03:00 +0100, Dermot wrote: > I was struggling with this before I left work. In a line like > print "Starting with ", $self->[0]->{type},"\n"; > > I got > > Starting with HASH(x0023408) > > Not what as I was hoping fo

Re: Self referencing hash

2008-08-12 Thread Rob Dixon
if you need to make things work faster. In any case, I'm certain that Conway didn't mean that things would be faster if you simply injected an extra level of indirection. $self->{type} will always be quicker than $self->[0]{type}. I guess what was intended was that an array access is fast

Re: Self referencing hash

2008-08-12 Thread Jenda Krynicky
From: "Mr. Shawn H. Corey" <[EMAIL PROTECTED]> > Yes, you have to do it after-the-fact, so to speak. > > #!/usr/bin/perl > > use strict; > use warnings; > use utf8; > > use Data::Dumper; > $Data::Dumper::Sortkeys = 1; > $Data::Dumper::Indent = 1; > $Data::Dumper::Maxdepth = 0; > > my %_HASH;

Re: Self referencing hash

2008-08-12 Thread Dermot
; freely as long as the the interface remains constant. I suggest you base your > implementation on a hash reference for convenience and readability, and switch > to an array reference if you need to make things work faster. > > In any case, I'm certain that Conway didn't mean th

Self made portable Perl

2009-08-26 Thread Panda-X
Hi folks, I am working on Win32, and I've made myself a portable system with a web server ( Xerver with Java ), an Active Perl 5.10, and my Perl Lib group, and my CGI scripts. Yet my ( so called ) portable Perl runs fine, and what I do in the setup process is just to extract the files from a zip

Re: bless $self, $class;

2006-02-17 Thread Kirill Ponomarew
On Fri, Feb 17, 2006 at 04:26:33PM +0800, Ken Perl wrote: > what does the statement mean? > > bless $self, $class; http://www.perl.com/doc/manual/html/pod/perlfunc/bless.html -Kirill -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECT

Re: bless $self, $class;

2006-02-17 Thread Chas Owens
On 2/17/06, Ken Perl <[EMAIL PROTECTED]> wrote: > what does the statement mean? > > bless $self, $class; snip This is how you make objects in Perl. The bless function adds some meta data to the variable that is blessed telling it that it is now of class $class. You will usually

RE: bless $self, $class;

2006-02-17 Thread Timothy Johnson
Also check out perldoc perltoot perldoc perltooc -Original Message- From: Kirill Ponomarew [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 12:30 AM To: Ken Perl Cc: Perl Beginners List Subject: Re: bless $self, $class; On Fri, Feb 17, 2006 at 04:26:33PM +0800, Ken Perl

Re: bless $self, $class;

2006-02-17 Thread David Kaufman
Hi Ken! Ken Perl <[EMAIL PROTECTED]> wrote: > > what does the statement mean? > > bless $self, $class; Thar is what a perl monk says to a his students when he sneezes during a lesson and no one says "Gazunteit". -dave -- To unsubscribe, e-mail: [EMAIL PROTEC

self referential arrays/hashes ?

2011-08-18 Thread Zak
can you reference elements of an array/hash from within that array/ hash for example would @array=(A, B, C, D, $array[0], E, F) fly? Zak -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

regex self taught, not fun...

2001-07-17 Thread Michael Carmody
Just fiddling with regex's because I see them in the digests everyday, and I though the best way to learn these is to try them. Currently sliding backwards down the learning curve... Just want to parse an email header containing addresses in format: >> Joe Frderick Blogss <[EMAIL PROTECTED]>

regex self taught, not fun...

2001-07-18 Thread Michael Carmody
Thanks for the regex, but that wasn't quite what I needed, it's functional but I still don't know how it works ! $line =~ s/^\s*(.+?)\s<(.+?)>,*/$1, $2/; OK so what does the $1 and $2 mean , what are they pointing to and how do I manipulate them... and what does the $& thingy do as well. Much

RE: what is $self->verbose

2002-10-09 Thread nkuipers
Supplying module names makes answering it easier to give a better answer. Idiomatically, $self usually refers to the scalar being blessed into a class, in other words, an object. So $self->verbose is indeed calling a method on the object using the indirect syntax, though whether or not t

RE: what is $self->verbose

2002-10-10 Thread Peter Scott
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Nkuipers) writes: >Supplying module names makes answering it easier to give a better answer. >Idiomatically, $self usually refers to the scalar being blessed into a class, >in other words, an object. Actually, it is not the

RE: what is $self->verbose

2002-10-10 Thread Jenda Krynicky
From: [EMAIL PROTECTED] (Peter Scott) > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Nkuipers) writes: > >Supplying module names makes answering it easier to give a better > >answer. Idiomatically, $self usually refers to the scalar being > >blessed in

Re: what is $self->verbose

2002-10-10 Thread Michael Fowler
On Thu, Oct 10, 2002 at 08:27:27PM +0200, Jenda Krynicky wrote: > It's the reference that's blessed. It's the referent that's blessed. For example: #!/usr/bin/perl -w use strict; my $s= 10; my $obj1 = \$s; bless($obj1, "Foo"); $obj1->foo();# prints "I am foo(

Re: what is $self->verbose

2002-10-10 Thread Jenda Krynicky
From: Michael Fowler <[EMAIL PROTECTED]> > On Thu, Oct 10, 2002 at 08:27:27PM +0200, Jenda Krynicky wrote: > > It's the reference that's blessed. > > It's the referent that's blessed. > > For example: > ... Oops. Sorry you are right. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky

Re: Locatiing Self-Installed Modules

2004-03-22 Thread Wiggins d'Anconia
Ron Goral wrote: Hello - I have a series of scripts and modules that I will self install, creating directories within the cgi-bin directory. The structure looks like this: |-- Base cgi-bin -- DsgnGrp --| |-- Utilities DsgnGrp contains the

RE: Locatiing Self-Installed Modules

2004-03-23 Thread Ron Goral
something like FindBin. Is there an alternative to this? Thanks again - Ron Goral > -Original Message- > From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] > Sent: Monday, March 22, 2004 7:10 PM > To: Ron Goral > Cc: Perl Beginners > Subject: Re: Locatiing Self-Inst

RE: Locatiing Self-Installed Modules

2004-03-23 Thread Wiggins d Anconia
> > Sent: Monday, March 22, 2004 7:10 PM > > To: Ron Goral > > Cc: Perl Beginners > > Subject: Re: Locatiing Self-Installed Modules > > > > > > Ron Goral wrote: > > > Hello - > > > > > > I have a series of scripts and m

RE: Locatiing Self-Installed Modules

2004-03-23 Thread Ron Goral
Sorry, not sure what "bottom post" means. > -Original Message- > From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 23, 2004 9:05 AM > To: Ron Goral; Perl Beginners > Subject: RE: Locatiing Self-Installed Modules > > > Please bottom

Re: Locatiing Self-Installed Modules

2004-03-23 Thread WC -Sx- Jones
Ron Goral wrote: Sorry, not sure what "bottom post" means. -Original Message- From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 9:05 AM To: Ron Goral; Perl Beginners Subject: RE: Locatiing Self-Installed Modules Please bottom post... This is cal

RE: Locatiing Self-Installed Modules

2004-03-23 Thread Bob Showalter
Ron Goral wrote: > Sorry, not sure what "bottom post" means. It means posting your new material below that which you are responding to, rather than at the top of the message. Lots of folks (me included) find this makes the thread easier to follow. Others disagree. If you use Outlook or Outlook Ex

RE: Locatiing Self-Installed Modules

2004-03-24 Thread Ron Goral
> -Original Message- > From: Bob Showalter [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 23, 2004 10:03 AM > To: 'Ron Goral'; Perl Beginners > Subject: RE: Locatiing Self-Installed Modules > > > Ron Goral wrote: > > Sorry, not sure what "

Daemon::Easy and self-killing

2009-10-14 Thread Michael Pobega
I'm using the Daemon::Easy module to write a basic Perl daemon, but I'm wondering if there is a way to stop the daemon from within the script (as opposed to running "./script.pl stop")? Currently I have a subroutine to do this, but it doesn't seem to cleanly erase the pid file. > &killMe { >

Re: self referential arrays/hashes ?

2011-08-18 Thread Dr.Ruud
On 2011-08-18 16:51, Zak wrote: can you reference elements of an array/hash from within that array/ hash for example would @array=(A, B, C, D, $array[0], E, F) fly? See Data::Alias and Array::RefElem. perl -Mstrict -MData::Dumper -MData::Alias -wle ' my @data = qw(A B C D A E F A B B A);

Re: self referential arrays/hashes ?

2011-08-18 Thread Rob Dixon
On 18/08/2011 15:51, Zak wrote: can you reference elements of an array/hash from within that array/ hash for example would @array=(A, B, C, D, $array[0], E, F) fly? You can write my @array; @array=('A', 'B', 'C', 'D', \$array[0], 'E', 'F'); What are you trying to do? Rob -- To unsub

Re: self referential arrays/hashes ?

2011-08-18 Thread Jim Gibson
On 8/18/11 Thu Aug 18, 2011 7:51 AM, "Zak" scribbled: > can you reference elements of an array/hash from within that array/ > hash for example would > > @array=(A, B, C, D, $array[0], E, F) > > fly? Try it out. See what you get. The above will not set the fifth element of @array to 'A', how

Re: self referential arrays/hashes ?

2011-08-18 Thread Shawn H Corey
On 11-08-18 10:51 AM, Zak wrote: @array=(A, B, C, D, $array[0], E, F) This is the same as: { my @temporary = @array; @array = ( A, B, C, D, $temporary[0], E, F ); } -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of understanding. Programming is as much

self referential arrays/hashes ? [sort]

2011-08-18 Thread shawn wilson
". $i . ":" . $sorted->[ $i ]->[ $j ]->[ 1 ] . " had " . $sorted->[ $i ]->[ $j ]->[ 0 ] . " duplicates\n" if( $sorted->[ $i ]->[ $j ] ); } } -- Forwarded message -- From: Rob Dixon Date: Thu, Aug 18, 2011 at 17:37 Subje

Re: self referential arrays/hashes ?

2011-08-18 Thread Dr.Ruud
On 2011-08-18 21:58, Dr.Ruud wrote: On 2011-08-18 16:51, Zak wrote: can you reference elements of an array/hash from within that array/ hash for example would @array=(A, B, C, D, $array[0], E, F) fly? See Data::Alias and Array::RefElem. perl -Mstrict -MData::Dumper -MData::Alias -wle '

Re: regex self taught, not fun...

2001-07-18 Thread David Wood
$line =~ s/^\s*(.+?)\s<(.+?)>,/$1, $2/; Michael Carmody wrote: > > Just fiddling with regex's because I see them in the digests everyday, and > I though the best way to learn these is to try them. > Currently sliding backwards down the learning curve... > > Just want to parse an email header co

RE: regex self taught, not fun...

2001-07-18 Thread Brian
Okay, the regexp: $line =~ s/^\s*(.+?)\s<(.+?)>,*/$1, $2/; Basically, $1 holds what is in the first set of (), and $2 holds what is matched in the second set of (). In otherwords, if you had the line: bob $1 would hold "bob", and $2 would hold "something in here". So, this regexp would rep

Re: Daemon::Easy and self-killing

2009-10-14 Thread Steve Bertrand
Michael Pobega wrote: > I'm using the Daemon::Easy module to write a basic Perl daemon, but I'm > wondering if there is a way to stop the daemon from within the script (as > opposed to running "./script.pl stop")? Currently I have a subroutine to do > this, but it doesn't seem to cleanly erase the

Re: Daemon::Easy and self-killing

2009-10-15 Thread Michael Pobega
On 0, Steve Bertrand wrote: > Michael Pobega wrote: > > I'm using the Daemon::Easy module to write a basic Perl daemon, but I'm > > wondering if there is a way to stop the daemon from within the script (as > > opposed to running "./script.pl stop")? Currently I have a subroutine to do > > this, b

how do I create self aware functions

2003-11-18 Thread Dan Anderson
Is it possible to create self aware functions (possibly using a magic variable)? I.e. functions that know their own name. Sort of the oppossite of bless. Basically, I want to create functions like: sub foo { my $self = shift (@_); my $name = decode_blessing ($self); } Does that

self centering random walk within defined range

2009-02-28 Thread rob
hi, i am finding something couter intuative about randomness and search for a solution. i have a bit of code that randomly selects a number from an array and then adds it to the previous number. I have two positive numbers and their negitives qw(1 2 -1 -2) i expected the below code to hover

Circular References, Self Referenced memory ang Garbage Collection

2005-01-04 Thread Marcos Rebelo
Some time ago I read one article about this Consider that you have: { # make $a point to itself my $a; $a = \$a; } Or { # make $a and $b point to each other my ($a, $b); $a = \$b; $b = \$a; } This memory will be free just at the end of the proce

Re: how do I create self aware functions

2003-11-18 Thread James Edward Gray II
On Nov 18, 2003, at 4:23 PM, Dan Anderson wrote: Is it possible to create self aware functions (possibly using a magic variable)? I.e. functions that know their own name. Sort of the oppossite of bless. You're looking for ref(), but first let me give you the "This is often a bad ide

Re: how do I create self aware functions

2003-11-18 Thread Dan Anderson
> You're looking for ref(), but first let me give you the "This is often > a bad idea" warning. What are you trying to use the object's name for? Debugging. I have a function that writes errors / warnings / errata to logs. Sometimes it could be more transparent if I included things like subrou

Re: how do I create self aware functions

2003-11-18 Thread drieux
On Tuesday, Nov 18, 2003, at 14:27 US/Pacific, James Edward Gray II wrote: On Nov 18, 2003, at 4:23 PM, Dan Anderson wrote: Is it possible to create self aware functions (possibly using a magic variable)? I.e. functions that know their own name. Sort of the oppossite of bless. You're lo

Re: how do I create self aware functions

2003-11-18 Thread Todd W.
"Dan Anderson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > You're looking for ref(), but first let me give you the "This is often > > a bad idea" warning. What are you trying to use the object's name for? > > Debugging. I have a function that writes errors / warnings / errata

Re: self centering random walk within defined range

2009-02-28 Thread Rob Dixon
r...@goto10.org wrote: > hi, > > i am finding something couter intuative about randomness and search for a > solution. > > i have a bit of code that randomly selects a number from an array and then > adds > it to the previous number. I have two positive numbers and their negitives > qw(1 2

Re: self centering random walk within defined range

2009-02-28 Thread rob
Rob Dixon said : > r...@goto10.org wrote: > > hi, > > > > i am finding something couter intuative about randomness and search for a > > solution. > > > > i have a bit of code that randomly selects a number from an array and then > > adds > > it to the previous number. I have two positive numb

Re: self centering random walk within defined range

2009-02-28 Thread Chas. Owens
On Sat, Feb 28, 2009 at 12:22, wrote: > Rob Dixon said : >> r...@goto10.org wrote: >> > hi, >> > >> > i am finding something couter intuative about randomness and search for a >> > solution. >> > >> > i have a bit of code that randomly selects a number from an array and then >> > adds >> > it to

Re: self centering random walk within defined range

2009-02-28 Thread Chas. Owens
On Sat, Feb 28, 2009 at 14:56, Chas. Owens wrote: snip > This seems close to what you want, but it needs work to make it take > steps larger than 1: snip Here is another version that takes steps larger than one: #!/usr/bin/perl use strict; use warnings; # 12345678901 # * # 5/11 chance of

Re: self centering random walk within defined range

2009-03-01 Thread Rob Canning
Chas. Owens said : > On Sat, Feb 28, 2009 at 14:56, Chas. Owens wrote: > snip > > This seems close to what you want, but it needs work to make it take > > steps larger than 1: > snip > > Here is another version that takes steps larger than one: > > #!/usr/bin/perl > > use strict; > use warnings

serious self confusion over line counts and hashs.

2010-04-25 Thread Harry Putnam
I've managed to confuse myself thoroughly working on a project. I hoped to read a list of -f type files into a hash of File::Find::name and $_. But kept coming out with different counts than I get with shell find. I tried writing a script that tested things various ways, but can't really reconc

Re: Circular References, Self Referenced memory ang Garbage Collection

2005-01-04 Thread Randy W. Sims
Marcos Rebelo wrote: Some time ago I read one article about this Consider that you have: { # make $a point to itself my $a; $a = \$a; } Or { # make $a and $b point to each other my ($a, $b); $a = \$b; $b = \$a; } This memory will be free just at the

Re: serious self confusion over line counts and hashs.

2010-04-25 Thread Shawn H Corey
Harry Putnam wrote: #!/usr/local/bin/perl use strict; use warnings; use File::Find; use Cwd; my %h1; my %h2; my $targ = shift; my @ckarr; my $h1ff = './h1'; my $h2ff = './h2'; my $ckff = './ckarr'; my $nf = './nf'; for($h1ff,$h2ff,$ckff,$nf){ if (-f $_){ print "deleting $_\n"; unli

Re: serious self confusion over line counts and hashs.

2010-04-25 Thread Harry Putnam
Shawn H Corey writes: > > close $h1fh or die "could not close $h1: $!\n"; > close $h2fh or die "could not close $h2: $!\n"; > close $ckfh or die "could not close $ckarr: $!\n"; > Output is buffered. The files have to be closed for the last lines to > be printed to the file. I was pretty sure

Re: serious self confusion over line counts and hashs.

2010-04-25 Thread Jim Gibson
At 4:37 PM -0500 4/25/10, Harry Putnam wrote: I do have another question that was only in the background of my first post. Is there a canonical way to read a bunch of -f type files into a hash? I take it you mean add the file names to a hash, not the file contents. I want the end name `$_'

Re: put an array into the 0th element of $self

2007-07-13 Thread Mr. Shawn H. Corey
Dr.Ruud wrote: "Chas Owens" schreef: [put an array @teams into the 0th element of $self] The proper syntax is $self->[0]{teams} = [ @teams ]; That makes a copy. If you don't want that, for example because it could contain millions of items, you can use $self-&g

is false self-evident? [was Re: Perl trainer requests beginner help]

2002-02-02 Thread Michael R. Wolf
[EMAIL PROTECTED] (John W. Krahn) writes: > "Michael R. Wolf" wrote: > > [...] > > Any value that is not false is true. What 3 values indicate > > false? > > > Are you sure there are only three? :-) > > $ perl -le' > print qq(undef is FALSE) unless undef; > print qq("" is FALSE)unless

Re: is false self-evident? [was Re: Perl trainer requests beginner help]

2002-02-02 Thread John W. Krahn
"Michael R. Wolf" wrote: > > [EMAIL PROTECTED] (John W. Krahn) writes: > > > > Are you sure there are only three? :-) > > > > $ perl -le' > > print qq(undef is FALSE) unless undef; > > print qq("" is FALSE)unless ""; > > print qq("0" is FALSE) unless "0"; > > print qq(0 is FALSE) unle

Re: is false self-evident? [was Re: Perl trainer requests beginner help]

2002-02-03 Thread Andrea Holstein
In article <[EMAIL PROTECTED]> wrote "John W. Krahn" <[EMAIL PROTECTED]>: > print q("0e0" is ), "0e0" ? "TRUE" : "FALSE"; > print q( 0e0 is ), 0e0 ? "TRUE" : "FALSE"; > ' > "0e0" is TRUE > 0e0 is FALSE Even without floats, there's a curious behaviour: > print q("00" is ), "00" ? "TRUE" : "FA

Re: is false self-evident? [was Re: Perl trainer requests beginner help]

2002-02-10 Thread Michael R. Wolf
[EMAIL PROTECTED] (John W. Krahn) writes: > "Michael R. Wolf" wrote: > > > > [EMAIL PROTECTED] (John W. Krahn) writes: > > > > > > Are you sure there are only three? :-) > > > > > > $ perl -le' > > > print qq(undef is FALSE) unless undef; > > > print qq("" is FALSE)unless ""; > > > print q

Re: is false self-evident? [was Re: Perl trainer requests beginner help]

2002-02-10 Thread Michael R. Wolf
[EMAIL PROTECTED] (Andrea Holstein) writes: > In article <[EMAIL PROTECTED]> wrote "John W. Krahn" <[EMAIL PROTECTED]>: [...] > > "00" is TRUE > > "0" is FALSE > > It's perhaps not so important for a beginners course, > but important to know. > > Last week, I wasted half an hour for understand

  1   2   >