hash increament

2008-06-18 Thread beast
Hi, What is the reason this following works $hours{$hour}->{count} + 1 but this not works? $hours{$hour}->{count}++ it actually part of this code: $hours{$hour} = { occur => $occur_utc, delay => $hours{$hour}->{delay} + $delay, count =>

making do work with strict

2008-06-17 Thread beast
I just want to load variable from config file: config.pl: $basedir = '/home/user/'; myprog.pl: #use strict; do 'config.pl' or die "can not open config\n"; # do some stuff here the problem is, i have to disable strict in myprog.pl. any other way to do it? Thanks. --budhi -- To unsubscrib

hash keys

2008-06-11 Thread beast
Hi All, Why this following code has not working as expected? print "Number of element(s) : " . sprintf("%10d", keys(%hash) ) . "\n"; Thanks. --budhi -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

perl daemon program

2008-05-30 Thread beast
Hi All, 1. Does Perl program suitable for long running process or daemon? 2. Is this considered as daemon program? $ cat myprog.pl while($true) { # do something } $ ./myprog.pl & Thanks. --budhi -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

parsing SQL statement

2008-05-30 Thread beast
Anyone having suggestion parsing SQL statement? It should able to parse: BLA BALA BALA... VALUES( 'abcd efg',,999, 'some \"STRING\" and \'STR2\' STR3' 'abcd, def, fghi' ) I'm using tr and then split by "," but it will fall when seeing comma inside the single quote. Thanks. --budhi --

Re: Comparing file contents, the perl way

2008-05-22 Thread beast
On Thu, May 22, 2008 at 2:52 PM, John W. Krahn <[EMAIL PROTECTED]> wrote: > 32134 > $ grep -f A.txt -wv B.txt > 82134 > Ouch, i never think that it can be so easy!! Thanks. --budhi -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.

Comparing file contents, the perl way

2008-05-21 Thread beast
Good morning, I have 2 files which contains some IDs. Basically I want to search ID in the file A which is missing on the file B. This program is ugly, but its work :-) use strict; my $target_file = "B.txt"; while(<>) { chomp; my $res = `grep $_ $target_file`; print "$_ is

Re: OT: help crle ruin my solaris :-(

2008-05-04 Thread beast
On Mon, May 5, 2008 at 10:38 AM, beast <[EMAIL PROTECTED]> wrote: > I've just want to avoid setting $LD_LIBRARY_PATH everytime i run my perl, > however after doing crle (i forgot the -u !) > > root# crle -l /usr/local/rrdtool-1.2.19/lib > > now all command refused to

OT: help crle ruin my solaris :-(

2008-05-04 Thread beast
I've just want to avoid setting $LD_LIBRARY_PATH everytime i run my perl, however after doing crle (i forgot the -u !) root# crle -l /usr/local/rrdtool-1.2.19/lib now all command refused to run (ls, cd etc) Somebody kind enough to help fix this pls? Now i can't do su or login as root, but still

Re: remove duplicate lines

2007-01-11 Thread beast
Dr.Ruud wrote: while ( ) { next if $d{$_}; print; $d{$_} = 1; } Got the idea. Many thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: remove duplicate lines

2007-01-10 Thread beast
Mumia W. wrote: On 01/10/2007 01:35 AM, beast wrote: [...] It will only remove duplicate key. Is this still acceptable in perl (its very ugly =( [...] This would remove duplicate lines: use List::MoreUtils qw(uniq); use File::Slurp; my @list = uniq read_file 'rm_dup_line

Re: remove duplicate lines

2007-01-09 Thread beast
Owen Cook wrote: my %data_hash; while(){ chomp; # Get rid of line feeds my @bits = split; $data_hash{$bits[0]} = $bits[1]; } It will only remove duplicate key. Is this still acceptable in perl (its very ugly =( while (<>) { chomp; my ($k, $v) = split /,/; my $tmp_key =

Re: remove duplicate lines

2007-01-09 Thread beast
Mathew Snyder wrote: The way I would do it is to place the initial data instance into a hash if it doesn't already exist. Just do a next if it does. It will remove duplicate key, not line. my %hash=(); while (<>) { chomp; my ($key, $val) = split /,/; $hash{$key} = $val; } while ( m

remove duplicate lines

2007-01-09 Thread beast
I have these following data: a 100 a 102 c 100 a 102 b 111 c 100 c 102 c 100 c 100 a 102 ... I would like to have a list (either array or hash) with unique line . Any help would appreciated. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECT

help on log parser

2007-01-04 Thread beast
arsing 1000 lines, so it must be run quickly before the next schedule. Any idea would be appreciated. --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: foolprof regex

2006-12-20 Thread beast
Chad Perrin wrote: At a wild guess, I'd say that you're probably getting the matches you want, plus getting the "my name =" as a match. The reason is that you didn't specify that the leading spaces before the word "name" must be at the beginning of the line. For that, use "^". Use "perldoc pe

foolprof regex

2006-12-19 Thread beast
Hi All, Basically I want these input : name= name= name= name = But I did not want these input: my name = name is = my name is = -- if ( /\s*name\s*=/) { print "Match: $_"; } did not works as i expected. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

validating SSHA pasword

2006-08-01 Thread Beast
Hello, Using Digest::MD5 i could simply using "eq" to validating user password, but how do I validate SSHA since encrypted results are always different? TIA --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://l

solved [was Re: Net::LDAP]

2006-07-06 Thread Beast
This aparently because of input is coming from and LANG=utf8 chomp($username=); my $exists = ldap_search($username); after set "LANG=en_US" it works. Anyone know the reason? Beast wrote: I have script which running fine on FC5 (perl v 5.8.1) but not working on RH9(5.8.0). --

Net::LDAP

2006-07-06 Thread Beast
I have script which running fine on FC5 (perl v 5.8.1) but not working on RH9(5.8.0). --- my $ldap = Net::LDAP->new($ldap_host); die "Unable to contact $ldap_host\n" unless defined $ldap; my $mesg = $ldap->bind; $mesg = $ldap->search( base => $ldap_base, scope => 'one', filter => "u

CPAN help

2006-06-13 Thread Beast
figuration file (http://cpan.cbn.net.id/, http://komo.vlsm.org/CPAN/) are valid. The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/' Could not fetch modules/03modlist.data.gz Going to write /root/.cpan/Metadata Warning: Cannot install Mail::SpamAssassin, don't kn

using shared lib?

2006-06-06 Thread Beast
Hello all, Just curious, is it possible to use shared library in perl? Suppose I want to use libexample.so and doesn't want to invoke the client command using system() TIA. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: sorting?

2006-05-30 Thread Beast
Beast wrote: Hi, I have some rather big chunk of data, returned from ldap server. The format is simple: "Displa name" <[EMAIL PROTECTED]> Simply displying data "as is" is simple, but how do I sorted by "display name"? pls note that "display name&

sorting?

2006-05-29 Thread Beast
Hi, I have some rather big chunk of data, returned from ldap server. The format is simple: "Displa name" <[EMAIL PROTECTED]> Simply displying data "as is" is simple, but how do I sorted by "display name"? pls note that "display name" contains space and might not unique so I can't put it on

sub never called

2006-05-23 Thread beast
I have these following code. It seems that sub is_exist never called more than once. I've checked ldap server log, the client never request for second search. Putting $ldap object inside every sub will solve the problem, but doesn't it expensive to create ldap connection object for every search?

Re: pseudohash

2006-02-12 Thread Beast
Tom Phoenix wrote: On 2/10/06, Beast <[EMAIL PROTECTED]> wrote: Could someone explain what is pseudohash means? A "pseudohash", much like "the macarena", "N-rays", "Herbalife", "Paris Hilton", "New Coke", and "Intel

pseudohash

2006-02-10 Thread Beast
Could someone explain what is pseudohash means? SOL. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: : shared

2005-12-16 Thread Beast
d details my $instaQuit : shared = FALSE; # used to pass back and forth quitting data my $vol : shared = 100; # volume my $mute : shared = 0; # used to store volume when jukebox is muted my $dofades : shared = 1; # should we use the fade effect? ...

: shared

2005-12-16 Thread Beast
I saw code which has something like : my $foo : shared = ''; my @bar : shared = (); ... What is that means? -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

use vars

2005-12-15 Thread Beast
uire "/etc/myprogram/myconfig"; # etc... # -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: weird external program output

2005-12-02 Thread Beast
rl? I'm using fping (http://www.fping.com/) which is merely ping in steroid. Later the helper script is not executing ping only, but can be any program. -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/

weird external program output

2005-12-02 Thread Beast
works (gives the correct output), but when scheduled using cron results is null/blank. If try to redirect the stderr and stdout also, no luck. my $ret = `/tmp/ping_yahoo.sh 2>&1`; -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Useless use of lc

2005-12-01 Thread Beast
Xavier Noria wrote: On Dec 1, 2005, at 12:48, Beast wrote: How do I avoid this kind of warning? Useless use of lc in void context at ./myscript.pl line 87. Tried to use : lc $string if $string; but still gives warning. I can count with my fingers the times a warning was not triggered

Useless use of lc

2005-12-01 Thread Beast
How do I avoid this kind of warning? Useless use of lc in void context at ./myscript.pl line 87. Tried to use : lc $string if $string; but still gives warning. -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <h

why not die?

2005-10-20 Thread Beast
-- It doesn't die or print any error even $log did not exist. why? -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

config parser

2005-10-16 Thread Beast
] subject = "Test mkt" body = "this is a test msg for mkt" group = accounting recipient = [EMAIL PROTECTED] subject = "Test acc" body = "this is a test msg for acct" -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

add timer to program

2005-10-14 Thread Beast
ot;$rcpt_number" 2>&1`; --- -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Use of uninitialized value

2005-09-09 Thread Beast
Charles K. Clarkson wrote: Beast <mailto:[EMAIL PROTECTED]> wrote: : my $value = get_value_from_external_program; : : How do avoid such warning, because value is coming from : external program thus I can't make sure that it will : return a string or null. What do you want

Use of uninitialized value

2005-09-09 Thread Beast
null. -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: getting the most efficient ways

2005-08-16 Thread Beast
Beast wrote: As you can see, the step will increase as the number of manager increase. Sorry, it should be: foreach my $emp (@employees) { foreach my $mgr (@managers) { if ($mgr eq $emp) { print "$emp is Manager\n"; next; } print "

getting the most efficient ways

2005-08-16 Thread Beast
$emp (@employees) { foreach my $mgr (@managers) { if ($mgr eq $emp) { print "$emp is Manager\n"; } else { print "$emp is Staff\n"; } } } ... As you can see, the step will increase as the number of manager increase. -- --beast -- To un

pointer

2005-07-22 Thread Beast
I found this code on some script : *test = \&show; What is "*" means? Isn't that reference/pointer is using "\" symbol? -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

OO in perl

2005-07-19 Thread Beast
Perl Object Oriented Programming is very confusing (to me at least :) --- package Test; sub new {} sub f_one{} sub f_two{} 1; --- I can call using my $test = Test->new->f_one; But why this not works? my $test = Test->new->f_one->f_two; -- --beast -- To unsu

Re: Limit memory used by perl

2005-07-14 Thread Beast
Brent Clark wrote: Beast wrote: Hi all, Is it possible to limit memory used by perl? I don't want perl program to eat all memory causing OS to freeze. Hi Maybe you should relook / think yout app and see where you can make it more effienct Yes maybe :-p I have prototype

Limit memory used by perl

2005-07-14 Thread Beast
Hi all, Is it possible to limit memory used by perl? I don't want perl program to eat all memory causing OS to freeze. -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

0; and 1;

2005-07-13 Thread Beast
I coudn't find any reference (yet) the meaning of 0; or 1; in the end of perl program. It means exit or return value? when I explicitly type "return 0;" it gives error, but when I give "exit 100;" the value of $$ isn't 100 anyway. -- --beast -- To unsubsc

Re: sorting list of array

2005-07-13 Thread Beast
my @sorted = sort { $a->[0] <=> $b->[0] } @employees; Thank you. However, is this scalable if, for example list is more than 5000 ? (ie. obtain data from ldap which we can not ask data provider to sort the entry for us) -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED] F

sorting list of array

2005-07-13 Thread Beast
I have an array: my @employee = ( [29243, 'john', 'John doe'], [24322, 'jane', 'Jane doe'], [27282, 'james', 'James doe'] ); Is there any builtin function in perl to sort the ab