Re: [Perl-unix-users] perl - Private Constructors - how do we do that.

2002-11-19 Thread Joseph . Cumming
Hello Ekta, I'm not sure if this is the correct way to do it, but you can implement a singleton like this:: package Singleton; eval { my $instance = {}; $instance->{TIME} = time(); $instance->{NAME} = "MyName"; bless ($instance, __PACKAGE__); } sub instance { return

Re: [Perl-unix-users] regexp question: $1 result (HTML formatted color-codedmail)

2002-10-18 Thread Joseph . Cumming
Roman, You don't need to do the substitute the second time. The first match will populate the $1 & $2 variables as intended and you can then manipulate them then as you wish in the subsequent expression: if ($k_7 =~ /^(www\.(\S+|$))/i) { $k_7 = "" . subtr($2, 0, 40) . "<\/A>"; } Joe

Re: [Perl-unix-users] portions of strings

2002-09-19 Thread Joseph . Cumming
HI kabana, This is something I do a lot so I wrote a little "utils" package to contain this and other common actions. Here is the subroutine. Pass it the name of the config file, a hash reference and an optinal delimeter. You will get back a hash populated with the details of the config file