Re: A way to comment out a block of code

2008-01-15 Thread Jeremy Kister
On 1/15/2008 3:09 PM, S.A. Birl wrote: Sometimes I find the need to comment out a block temporarily. My roots go back to C where I could quickly throw a #if 0 #endif if(0){ [...] } -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: using scalar as an operator

2007-12-31 Thread Jeremy Kister
On 12/31/2007 7:10 PM, Chas. Owens wrote: Use the embedded pattern-match modifier. See perldoc perlre or http://perldoc.perl.org/perlre.html#'(%3fpimsx-imsx)' for more information. That's good info, thanks for the pointer! -- Jeremy Kister http://jeremy.kister.net./ -- To

Re: using scalar as an operator

2007-12-31 Thread Jeremy Kister
On 12/31/2007 7:09 PM, Tom Phoenix wrote: There is no correct way to use a variable as an operator. [...] This is why '(?i)' was invented. You want something like this: perfect. Thanks! -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROT

using scalar as an operator

2007-12-31 Thread Jeremy Kister
print "match\n"; } Thanks, -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: dereferencing

2007-10-29 Thread Jeremy Kister
even possible, but I can't see any reason to need it, either. Oops. I knew I was making a new hash (hence the variable name). I read his message (and subject) to imply that all he wanted was dereferencing. My fault. -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-ma

Re: dereferencing

2007-10-29 Thread Jeremy Kister
On 10/29/2007 7:23 PM, Aaron Priven wrote: my $hashref = \%hash; But as near as I can tell, there is no way to do the reverse operation: making a "my %hash" that is an alias for a hash reference. my %newhash = %{$hashref}; -- Jeremy Kister http://jeremy.kister.net./ -- To u

Re: Allow user to input data until user press a certain key

2007-10-21 Thread Jeremy Kister
oreach my $word (split(/\W+/, $_)){ print "<$word>\n" if($DEBUG); } } also, you probably mean /^q$/i in that first regex, otherwise you're matching any letter q -- quick, squid, etc -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PRO

strict behavior with .pm

2007-09-28 Thread Jeremy Kister
go { my $variable; push @variable, 1; return([EMAIL PROTECTED]); } 1; __END__ -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: sorting speed

2007-09-10 Thread Jeremy Kister
On 9/10/2007 5:13 PM, Rob Dixon wrote: use List::Util qw/max/; my %hash = (x => [ 'a','b','c' ], y => [ 'd','e' ], z => [ 'f' ], ); my $most = max map scalar @$_, values %hash; Woah!

Re: sorting speed

2007-09-10 Thread Jeremy Kister
On 9/10/2007 4:45 PM, Jeremy Kister wrote: if(@{$hash{$key}} > $highest){ oops, that's if(@{$hash{$key}} > $most){ not $highest. -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROT

sorting speed

2007-09-10 Thread Jeremy Kister
my $most = @{$hash{(sort { @{$hash{$b}} <=> @{$hash{$a}} } keys %hash)[0]}}; I ran each 500,000 times. I expected the second version finish sooner, but it is noticeably slower than the first. Can someone show me a better way to get this done ? -- Jeremy Kister http://jeremy.ki

Re: Printing a backspace?

2007-07-21 Thread Jeremy Kister
"; print "\n"; or use a module that does it for you.. use Term::ReadKey; print "passwd: "; ReadMode 2; chop(my $passwd=); ReadMode 0; print "\n"; -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Net::BGP advise

2007-05-27 Thread Jeremy Kister
On 5/26/2007 8:27 PM, Jeremy Kister wrote: > I'm sure I'm just using the code incorrectly, but can't figure the > right way to do it. I've figured out the logic. $peer->update must go inside on of the peer callbacks. I can simply add conditionals inside my time

Net::BGP advise

2007-05-26 Thread Jeremy Kister
Then the bgp session establishes, but the /32 is not injected. If put $peer->add_timer(\&foo, 20); right before $bgp->event_loop, and put $peer->update inside sub foo, then the injection works, but I resend the update every x seconds. I'm sure I'm just using the code incorre

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeremy Kister
st. Should I take this over to the mysql-perl list ? Thanks! -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: forking problem with dbd::mysql [dupe]

2007-05-09 Thread Jeremy Kister
On 5/8/2007 6:46 PM, Jeremy Kister wrote: > I'm utilizing fork for the first time, and am having an issue which I > can't track down. I sent this original email with a bad return address. Four and a half hours later, when the post still didnt make it to the list, I realized tha

forking problem with dbd::mysql

2007-05-09 Thread Jeremy Kister
SULT: 1 SQL RESULT: 1 DBD::mysql::st execute failed: MySQL server has gone away at ftest.pl line 36, line 3. DBD::mysql::st execute failed: MySQL server has gone away at ftest.pl line 36, line 3. What's gone wrong? perl 5.8.3, sun4-solaris DBI 1.55 DBD::mysql 3.0007 -- Jeremy Kister htt

Re: forking problem with dbd::mysql

2007-05-08 Thread Jeremy Kister
nal to parent,maybe this > break the dbh connection?try to add these 2 lines in parent code: > > use POSIX qw(:signal_h WNOHANG); > $SIG{CHLD}=sub {while((my $child=waitpid(-1,WNOHANG))>0){}}; Nope, same problem. Thanks, -- Jeremy Kister http://jeremy.kister.net./ -- To unsubs

forking problem with dbd::mysql

2007-05-08 Thread Jeremy Kister
as it can. But instead: SQL RESULT: 1 SQL RESULT: 1 SQL RESULT: 1 DBD::mysql::st execute failed: MySQL server has gone away at ftest.pl line 36, line 3. DBD::mysql::st execute failed: MySQL server has gone away at ftest.pl line 36, line 3. What's gone wrong? perl 5.8.3, sun4-solaris DBI

Re: sending a variable in a Net::SMTP message not working

2007-02-02 Thread Jeremy Kister
n with an empty line? If not, you're not separating the header from the message body, and your MUA thinks the whole message is a header. $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); $smtp->datasend($file); -- Jeremy Kister http://jeremy.kister.

CGI bug

2006-10-05 Thread Jeremy Kister
;,$y), "\n", $q->hidden('a',$y), "\n", $q->end_html(); using script.pl?x=5, you'll see that the cgi prints x=5 but a=6 apparently only happens when you're setting a parameter via 'hidden' that was read by 'param'

regex quoting

2006-07-28 Thread Jeremy Kister
perldoc -q quote talks about \Q before a regex to escape special characters. how do you use \Q when you want to anchor the regex with a dollar sign ? my $string = my $regex = "foo"; print "match\n" if($string =~ /^\Q${regex}$/); -- Jeremy Kister http://jeremy

Re: unscrambler speedup rewrite

2006-06-19 Thread Jeremy Kister
On 6/19/2006 11:54 PM, Jeremy Kister wrote: I wrote a word descrambler that works very well, but is very slow compared to http://www.jumble.org already found a very important piece that I missed ($lfound).. while(1){ print "word: "; chop(my $scramble = );

unscrambler speedup rewrite

2006-06-19 Thread Jeremy Kister
next unless($found == $slen); print "$word\n"; } } -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: sdf

2006-01-13 Thread Jeremy Kister
han a 10 character message? -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: grep mystery / What happened to my @ sign ?

2005-11-22 Thread Jeremy Kister
"[EMAIL PROTECTED]'; it also doesnt appear that you need m/ --- / will do fine by itself in this context. -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

hashrefs inside arrays

2005-11-10 Thread Jeremy Kister
Can't use string ("string1") as a HASH ref while "strict refs" in use What's the correct method for this? -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: more hashref within array sorting

2005-08-09 Thread Jeremy Kister
On 8/9/2005 8:43 AM, John W. Krahn wrote: > Jeremy Kister wrote: >>I've apparently dumbed down my code and question a bit too much: I have >>multiple hashrefs in each element of the array, and I need the resulting >>sorted array to contain all the data in the original

Re: more hashref within array sorting

2005-08-09 Thread Jeremy Kister
ontain all the data in the original array, simply sorted by the value of N. my @a = ( {N => '10.1.2.1', ID => 1}, {N => '10.1.9.1', ID => 2}, {N => '10.3.5.1', ID => 3}, {N => '10.1.1.3', ID =>

more hashref within array sorting

2005-08-09 Thread Jeremy Kister
$a->[3] <=> $b->[3] } map { [ $_, split /\./ ] } $a->{N}; but that simply fails to produce. I've replaced $a->{N} with multiple variations, but I'm confused. If someone can give me code, I'd also appreciate a clue. thanks, -- Jerem

sorting array full of hash references

2005-06-07 Thread Jeremy Kister
after the while loop, I'm trying to build a new version of @array, sorted by the 'name' key. Anyone feel like throwing example code my way? -- Jeremy Kister http://jeremy.kister.net./ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

regex seg fault on long string

2004-12-02 Thread Jeremy Kister
fine with perl 5.6.0, 5.6.1, and 5.8.5 (assuming perl is the difference, and not the differences between Solaris 7 and 9) Is there a more compatible way to check my overly-long string? Is this a problem with perl 5.8.0? Is this simply some kind of resource exaustion on my system ? -- Jeremy K

Re: sorting with Swartz Transform

2004-11-28 Thread Jeremy Kister
<=> $b->[4] > > || > > $a->[5] <=> $b->[5] > > } map { [ $_, split /[. ]/ ] } @unsorted; wild.. But since the data is already in a hash, are you suggesting to first loop through the hash, pushing the

sorting with Swartz Transform

2004-11-28 Thread Jeremy Kister
uot;; } foreach my $sorted (map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_,split] } @unsorted){ print "$sorted\n"; } -- Jeremy Kister http://jeremy.kister.net/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

PROTO in sub NAME (PROTO) {

2004-09-21 Thread Jeremy Kister
on. there doesnt seem to be any warning or error when you ($$$) but only provide 1 argument, for example. Jeremy Kister http://jeremy.kister.net/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: get last record in a file

2004-08-26 Thread Jeremy Kister
correctly. Either solution from myself or from Gunnar will work. Jeremy Kister http://jeremy.kister.net/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: get last record in a file

2004-08-25 Thread Jeremy Kister
sh){ print "$value\n"; } Jeremy Kister http://jeremy.kister.net/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: get last record in a file

2004-08-25 Thread Jeremy Kister
On Wednesday, August 25, 2004 5:57 PM, loan tran wrote: > So for example here is my file: > 1 5 4 > 1 0 2 > 1 2 2 > 2 0 2 > 3 0 3 > 3 4 6 > And here is the output file I want: > 1 2 2 > 2 0 2 > 3 4 6 not extensively tested: #!/usr/local/bin/perl open(F, "file.txt"); while(){

Re: Assigning fix elements of array into fix variables efficiently

2004-08-23 Thread Jeremy Kister
On Monday, August 23, 2004 3:12 AM, Edward Wijaya wrote: > @array = (10,11,12) #fix to three element > > is there any way I can assign each any of these > elements into variable ($A, $B, $C) in a quick way. > Such that $A = 10, $B =11, $C=12 (this is fixed). ($a,$b,$c) = @array;

Re: multiplexing Net::DNS::Nameserver

2004-08-20 Thread Jeremy Kister
inary gamble (or maybe a "blind" bet) > and say POE can do it :-) I'm looking at it now... thanks again. Jeremy Kister http://jeremy.kister.net/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: multiplexing Net::DNS::Nameserver

2004-08-20 Thread Jeremy Kister
On Wednesday, August 18, 2004 5:56 PM, I wrote: > can anyone give me a clue as to how to use IO::Multiplex on top of > Net::DNS::Nameserver? Is there a more advanced Perl list than perl-beginners, where someone may have hints? I've browsed lists.perl.org but found nothing appropria

multiplexing Net::DNS::Nameserver

2004-08-18 Thread Jeremy Kister
can anyone give me a clue as to how to use IO::Multiplex on top of Net::DNS::Nameserver? I'm assuming that $ns->main_loop would go inside the mux_input sub, but am confused on how IO::Multiplex actually gives data to Net::DNS::Nameserver. Thanks, Jeremy Kister http://jeremy.ki

read multi-line banner w/ IO::Socket

2004-08-13 Thread Jeremy Kister
e (which could cause it to wait for input) ? I've looked at Net::SMTP, but see that it incorrectly assumes only the first line is the banner. Note that I'm not looking for a solution for only SMTP (where the /200\s/ give me a way to cheat), but a solution to the problem as a whole. Jer