RE: Another Regular expression problem
-Original Message- From: Electron One [mailto:[EMAIL PROTECTED] Sent: Monday, March 10, 2003 12:12 PM To: [EMAIL PROTECTED] Cc: Electron One Subject: Another Regular expression problem Hello Everyone, I have a perl file that has this, PerlFile.pl### #!/usr/bin/perl while(){ chomp; if(/\s*\$[a-z]\w+\s*/i){ #if(/\b\$[a-z]\w+\b/i){ print Matched: $` -- $ -- $' :\n; } else{ print No match:$_\n; } } ## ## I have another file that has this in it, testfile.txt## # $he1lo is the name of a variable what is not allowed $0 is this but this is $a123wgfd343w cool this is correct though $hello dont know why didnt work before. I sure hope this doesnt pass alf$f12w32 cuz it shouldnt $alfonso does match though $hello ## The perl code is basically supposed to look for real possible scalar variable names. So there should only be two failures, the second and fifth line should not pass. Now, if I run the program how it is, I get this, answer1.txt### ## Matched: -- $he1lo -- is the name of a variable : No match:what is not allowed $0 is this Matched: but this is -- $a123wgfd343w -- cool : Matched: this is correct though -- $hello -- dont know why didnt work before. : Matched: I sure hope this doesnt pass alf -- $f12w32 -- cuz it shouldnt : Matched: -- $alfonso -- does match though : Matched: -- $hello -- : No match: ## if i run it with the commented section as the if statement, and the current if statement commented out, i get this, ###answer2.txt ## No match:$he1lo is the name of a variable No match:what is not allowed $0 is this No match:but this is $a123wgfd343w cool No match:this is correct though $hello dont know why didnt work before. Matched: I sure hope this doesnt pass alf -- $f12w32 -- cuz it shouldnt : No match:$alfonso does match though No match:$hello No match: ## # With regard to answer2.txt, why doesn't it match lines 1,3,4,5 and 6? In the camel book(pg40), it says that the word bound \b matches the beginning of lines. Any advice would be appreciated. Thanks. Beats me...I can't wait to find out the answer to this one. $Bill, explain it to us idiots... ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Trouble with my variables.
-Original Message- From: Beckett Richard-qswi266 [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 7:29 AM To: [EMAIL PROTECTED] Subject: RE: Trouble with my variables. Thanks, guys. I'm not sure I can explain what I thought, but here's a go... I thought that: If you define a variable with 'my' in the main part of the script, it is available to all parts of that script, including subroutines. In a subroutine, if you define a variable that is only used in that subroutine with 'my' it would prevent any problems occurring due to 2 variables having the same name. If in a subroutine, you defined a variable with 'my', any subsequent subroutines called would also see the variable. Looks like I got the last one wrong :-( R. Not far wrong...subsequent subroutines do not see 'my' variables declared inside other subroutines, since they are in different scopes (all subroutines exist at the same level, so they *must* be in different scopes). Nested code blocks *within* a subroutine can see any 'my' variables set in enclosing blocks, and this is the best way to think ov the scoping of 'my' variables, in general. The script itself is the highest enclosing block, so a 'my' variable declared in the main part of the script is visible (in-scope) to all enclosed blocks, including subroutines. Example: #!perl -w my $value = 1; #globally scoped print main::\$value = $value\n; one(); two(); sub one { my $value = one; #local to this sub print sub one::\$value = $value\n; for (my $ii = 1; $ii 10; $ii++) { my $value = $ii; #local to this loop print sub one::loop::\$value = $value\n; } } sub two { print \$value = $value\n; #not declared with 'my', so inherited from main } perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Case insensitive search help
-Original Message- From: steve silvers [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 10:26 AM To: [EMAIL PROTECTED] Subject: Case insensitive search help My form passes the search param to my script. My sql call is something like. my $search = $query-param('search'); SELECT * FROM table WHERE search_col LIKE '%$search%' But if I enter the search term ORACLE or oracle I get different results.. Does anyone kown how to work around this case sensitive prolem. Thanks in advance. Steve I don't know if you're using MS-SQL server, or oracle, but check for the UPPER() and LOWER() functions...for example, if you make sure your search term is in all lowercase (use lc() on it), you could use the following query: SELECT * FROM table WHERE LOWER(search_col) LIKE '%$search%' perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Trouble with my variables.
-Original Message- From: Beckett Richard-qswi266 [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 10:07 AM To: [EMAIL PROTECTED] Subject: RE: Trouble with my variables. Still having harassments... I now invoke the sub thusly... update_value(ftp, $ftp{$key}{value}, $key); The sub is like this... sub update_value { $entry{$_[0]}{$key} - delete (0, end); $entry{$_[0]}{$key} - insert (end, $_[1]); } I get: Global symbol $key requires explicit package name at v06b.pl line 1561. Global symbol $key requires explicit package name at v06b.pl line 1562. Execution of v06b.pl aborted due to compilation errors. If I use $_[2] instead of $key, then it works. Is there a way of passing $key as $key to the sub? Thanks. R. The reason $key won't work is that if you want it to, you'll have to create a new local variable called $key inside the sub...change the subroutine like so: sub update_value { $key = $_[2]; $entry{$_[0]}{$key} - delete (0, end); $entry{$_[0]}{$key} - insert (end, $_[1]); } Note that it'll take a little extra time and memory to copy $_[2] to another variable, but since I don't know why you want to do it, I can't advise on whether you should bother or not. perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Case insensitive search help
Comments in-line... -Original Message- From: Ross Matt-QMR000 [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 10:50 AM To: [EMAIL PROTECTED] Subject: RE: Case insensitive search help that just looks for the lower case. is there something that Not quite...look closer tells oracle to be case insensitive? lc stands for lower case and uc is for upper case ... right I am really new to the SQL side so I would understand if I am totally wrong Matt -Original Message- From: Oleksandr Pavlyk [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 10:33 AM To: steve silvers Cc: [EMAIL PROTECTED] Subject: Re: Case insensitive search help Something like this my $search = lc( $query-param('search')); search term is now lower case... $sql = $dbh-prepare(qq{SELECT fields FROM table WHERE lower(search_col ) LIKE '%$search%'}); $sql-execute(); SQL query is now comparing search string against search_col converted to lowercase ala lower(search_col) I checked it on MySQL 4.0.10. Good luck, Sasha steve silvers wrote: My form passes the search param to my script. My sql call is something like. my $search = $query-param('search'); SELECT * FROM table WHERE search_col LIKE '%$search%' But if I enter the search term ORACLE or oracle I get different results.. Does anyone kown how to work around this case sensitive prolem. Thanks in advance. Steve _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: please help me with following error
snip From: Nagesh Pai [mailto:[EMAIL PROTECTED]] Sent: Monday, February 10, 2003 7:42 PM To: [EMAIL PROTECTED] Subject: please help me with following error I have installed active state perl on windows 2000 professional operating system. I copied all the modules required for running a perl script that I use quite often in unix. /snip You say that you copied the modules, and you mention UNIX...If you're using ActiveState, it's probably a good idea to use PPM to re-install those packages. There may be a few missing dependencies, and it's easy enough to miss a package that the one you're using depends on. I'd begin there, especially if the module seems to be working but erroring. Failing that, you can try to contact the author of the module about it. perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Convert disk space size to readable form.
-Original Message- From: Peter Guzis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 2:56 PM To: [EMAIL PROTECTED] Subject: RE: Convert disk space size to readable form. That's not quite accurate. Take a look at http://physics.nist.gov/cuu/Units/binary.html. Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: C. Church [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 8:13 AM To: [EMAIL PROTECTED] Subject: Re: Convert disk space size to readable form. C:\ Total drive size = 2253693952 Total free space = 914102784 D:\ Total drive size = 18202509312 Total free space = 3483238400 I need it to be like 2,145 Mb and/or 17,223 Gb. 1 Byte = 8 bits 1 Kilobyte = 1024 Bytes 1 Megabyte = 1024 KB 1 Gigabyte = 1024 MB 1 Terabyte = 1024 GB I don't think you need any special routine to calculate MB from b. ( So, umm.. why don't you just divide? ) !c While that may not be quite technically accurate, there are a number of places that this is ignored...example: dir command output says 556,478,464 bytes free Windows explorer says 530MB free Even the default human-readable switch (-h or --human-readable) for linux's df command responds that way. You have to use -H or --si to get 1000 as a divisor. Correct or not, it's used some places... perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Encryption question
-Original Message- From: Frazier, Joe Jr [mailto:[EMAIL PROTECTED]] Sent: Friday, December 27, 2002 2:49 PM To: [EMAIL PROTECTED] Subject: Encryption question Anyone have any simple sample code for encryption and decryption? I am not sure I get it. I have tried using Crypt::CBC =blowfish (amoung other encryption routines, but am unable to decrypt the result given the same key). I just am not sure if I am doing it wrong or what. Basically, I need to encrypt a string, store it in a file or the registry, read with another process at some other time and decrypt it. I really dont care what type of encryption package (given it installs on Win32), itjust needs to be something stronger then Mime::Base64 or some simular easy to break encryption or obfuscation. Help! Joe I don't know if this will help, and I haven't looked at it in a few months, but it should give you a hint or two... crypt.pl #!perl -w use strict; use Cwd; use Digest::MD5; use Crypt::CBC; use Crypt::Blowfish; sub crypter($$$) { my ($infile,$outfile,$method) = @_; my $key; my $data; print $infile $outfile $method\n; #exit; print Please enter a cipher key (8-56 characters): ; $key = STDIN; chomp($key); my $cipher = Crypt::CBC-new( {'key' = $key, 'cipher' = 'Blowfish', }); $cipher-start($method); open (INFILE, $infile) || die Could not open $infile: $!; binmode(INFILE); open (OUTFILE, $outfile) || die Could not create $outfile: $!; binmode(OUTFILE); if ($method =~ /d/) { my $count = 0; while (read (INFILE,my $buffer,8)) { $data = $cipher-crypt($buffer); if ($count 2) { print OUTFILE $data; } $count++; } } else { while (read (INFILE,my $buffer,8)) { $data = $cipher-crypt($buffer); print OUTFILE $data; } } close OUTFILE; close INFILE; } sub usage() { print Usage: perl crypt.pl [-e|-d] drive:/path/to/input/file.ext drive:/path/to/output/file.ext\n; print \nSwitches:\n; print \t-e\tEncrypt the input file and write the garbled data to the output file\n; print \t-d\tDecrypt the input file and write the plain-text data to the output file\n; print \nExamples:\n; print \tcrypt -e c:/plain.txt c:/encrypted.txt\n; print \tcrypt -d c:/encrypted.txt c:/plain.txt\n; } if (@ARGV == 3) { my $method = $ARGV[0]; my $infile = $ARGV[1]; my $outfile = $ARGV[2]; my $file; my $path; unless (-f $infile) { die Input file problem ($infile): $!; } if ($outfile =~ /\//) { $file = (split(/\//,$outfile))[-1]; $path = (split(/$file/,$outfile))[0]; } else { $file = $outfile; $path = cwd(); } unless (-d $path) { die Output directory problem ($path): $!; } if ($method =~ /^-e/i) { crypter($infile,$outfile,e); } elsif ($method =~ /^-d/i) { crypter($infile,$outfile,d); } else { print Bad Method\n; usage(); } } elsif (@ARGV == 0) { usage(); } else { print Wrong number of arguments\n; usage(); } ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: strage slowdown
Steve said: snip I am rewriting some code that computes a statistic on data containted in each possible pair of files in a list. I thought I would make it go faster, but it's going slower. This makes no sense because the two pieces of code are doing the same thing (produce identical results), and many cycles should be saved with the newer design: It does not reload and reparse data files multiple times, and its second loop eliminates a large number of zero-cases from the computations. I've put some perl-ish pseudocode for the two approaches below. Approach 1 (old) runs 500 files in 9:08. Approach 2 (new) runs same files in 15:16 :-( Anyone know why aproach 2 could be going slower? Steve approach 1 psuudocode: ... approach 2 pseudocode: ... /snip Well, I'm not sure what to say here. Psedocode is well and good for fleshing out an idea, but you're asking about optimization and/or bugfixing on code that you haven't shown. Those kinds of tasks *especially* need visibility of the orogonal code (pertinent portions, at least). You might just have easily said: Pseudocode 1: Open a file Loop through stuff { Do things Loop through stuff some more { } } Pseudocode 2: Open a file Loop through stuff { Do things differently } Give us a hint. perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Problems with Win32::TieRegistry SetValue for REG_MULTI_SZ type.
-Original Message- From: Lee Clemmer [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 2:42 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Problems with Win32::TieRegistry SetValue for REG_MULTI_SZ type. When I use this function: $key-SetValue( [Val1,Value2,LastVal], REG_MULTI_SZ ); with a named array, like so: $retval = $key-SetValue(TurfTable, @junklist, REG_MULTI_SZ ); Instead of getting the expected null terminated strings in the value, I get some other weirdness. If you edit the value directly with Regedt32 then you must enter multiple values with carriage returns, which the program (Regedt32) magically transforms into nulls. I've seen in the documentation a reference to a null as '\0' and also, in the documentation for SetValue as \000. This is extremely frustrating as I can read the data from the value into an array with no problems, but I cannot update or create a value which is valid. String data gets written there with an odd char. separating the strings. (looks like a little box, used when an invalid ASCII char is present). I'm also a bit unclear on the required two nulls at the end. Must I create an array value containing these, or must I stringify the array and concatenate two nulls to the end?? Which of the formats for null above are correct? What the heck is the secret??? There surely is a way to do this EASILY. Any advice would be greatly appreciated. I JUST tried this with the syntax shown in the example (valuename,[foo.com,bar.com, bax.com],REG_MULTI_SZ) What is the difference between my named array and an anonymous one?! Lee My authoritative source (Programming Perl aka The Camel) says: You can create a reference to an anonymous array using brackets (Chapter 4...search the index for [) So, assuming @junklist = (foo.com,bar.com, bax.com)... [foo.com,bar.com, bax.com] is NOT the same as @junklist, but [foo.com,bar.com, bax.com] IS the same as \@junklist. I don't know for certain that this is the problem, but try turning your array (@junklist) into an array ref (\@junklist) and see if it works any better. perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Problems with Win32::TieRegistry SetValue for REG_MULTI_SZ type.
(From the Activestate docs on Win32::TieRegistry...) snip REG_MULTI_SZ These values can also be specified as a reference to a list of strings. For example, the following two lines are equivalent: $key-SetValue( Val1\000Value2\000LastVal\000\000, REG_MULTI_SZ ); $key-SetValue( [Val1,Value2,LastVal], REG_MULTI_SZ ); Note that if the required two trailing nulls (\000\000) are missing, then this release of SetValue() will not add them. /snip So, what the documentation is telling you is that a null-delimited concatenation of values (with an extra null at the end) is an alternative to passing an array reference. If @junklist = (Val1,Value2,LastVal), then you could write any of these three forms... $key-SetValue( [Val1,Value2,LastVal], REG_MULTI_SZ ); $key-SetValue( Val1\000Value2\000LastVal\000\000, REG_MULTI_SZ ); $key-SetValue( \@junklist, REG_MULTI_SZ ); And they mean exactly the same thing. perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Loop syntax problem.
-Original Message- From: Beckett Richard-qswi266 [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 10:25 AM To: Perl-Win32-Users Subject: Loop syntax problem. Hello World! I have a loop syntax problem. When [1] a Stupid User (TM) enters a non numeric value for $number, my loop falls over. I'm trying to trap this error condition, and thought that die would be a nice way to do it, especially as I'm using Tk::ErrorDialog. Unfortunately I can'd find the syntax for what I want to do. This is the gist, but doesn't work... for ($loop = 1; $loop = $ping_number; $loop++) { print $loop\n; } or die \$ping_number not numeric; Can anyone help? Thanks. R. [1] I was going to say if... ;-) Check ahead of time to see if $ping_number is numeric... if ($ping_number !~ /\D/) { for ($loop = 1; $loop = $ping_number; $loop++) { print $loop\n; } } else { die \$ping_number ($ping_number) is not numeric; } perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: AutoIncrement hash value
-Original Message- From: Capacio, Paula J [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 2:59 PM To: Perl-Win32-Users (E-mail) Subject: AutoIncrement hash value I was using a hash to accumulate occurrences of a string (jobnames) in the file and I tried to use ++ to auto increment; but it didn't work. Since TMTOWTDI, I found an easy solution but I'm just curious as to why this doesn't work. Shouldn't the value of key 'A' be 2?; why doesn't ++ work or what did I do wrong? TIA Paula _SNIPPET_ use strict; my %hash; $hash{'A'} = '0'; #why doesn't this work... $hash{'A'} = $hash{'A'}++; Change that to just: $hash{'A'}++; #isn't it logically equivalent to this? $hash{'A'} = $hash{'A'}+1; print VALUE of A:$hash{'A'}\n; _END SNIPPET_ ___ perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Net-DNS for 5.8/802
Does anybody know where I can find a Net-DNS module built for ActivePerl build 802? I'm not in dire need, but it'd be nice. perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Mail::Sendmail not working for me anymore
Comments inline... snip ... $mail{Date} = Mail::Sendmail::time_to_date( time() ); sendmail(%mail) or die I am dead; # yields these results: # Unquoted string dead may clash with future reserved word at \\web-mplan\admins cripts\simmail.pl line 10. retrying in 1 seconds... connect to my-workstation-name.eglin.af.mil failed (Unknown error) no (more) retries!C an't locate object method I via package am (perhaps you forgot to load am? ) at \\my_server_name\adminscripts\simmail.pl line 10. /snip Need quotes around I am dead... snip ... $mail{Text} = Hello, I have done something. Please let me know if you want something else. Thanks! TYBRIN Corporation print $mail{To}\n; ... /snip Need quotes before that print line, plus the replacement of actual newlines with the \n character sequence (and a semicolon to finish it off)...i.e. $mail{Text} = Hello,\nI have done something.\n\nPlease let me know if you want something else.\nThanks!\nTYBRIN\nCorporation\n; perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: regular expression question
Cai Lixin said: all, I want to check the first line of the file if it is machine or not, like The first line of the file is: Job \nest and \toolbox VOBs began execution on 9/6/02 at 2:00:11 AM. my code is like: if (!-z $file) { open(LOG_FILE, $file) or warn can not open $file:$!\n; my @read_lines = LOG_FILE; close (LOG_FILE); next unless chomp($read_lines[0]) =~ m#\\nest and \toolbox VOBs\#; } it did not work for regular expression, can you help me to figure what is wrong with it? You forgot to escape the backslashes...change your code to read: next unless chomp($read_lines[0]) =~ m#\\\nest and \\toolbox VOBs\#) perl -e sub Sub{return reverse(@_);}$_='.$yyye k ca i Xl $yyye jX $yyye hto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);$print=join('',Sub(split('')));system( 'echo',$print); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: regular expression question
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 4:38 PM To: Stovall, Adrian M.; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: regular expression question I tried that, it does not work for me! Lixin This code should print yes, if it does, then the code works for you... $line = 'Job \nest and \toolbox VOBs began execution on 9/6/02 at 2:00:11 AM.'; print $line\n; if ($line =~ m#\\\nest and \\toolbox VOBs\#) { print yes; } else { print no; } perl -e sub Sub{return reverse(@_);}$i='ohce';$_='.$yyye k ca i Xl $yyye jX $yyyehto ZfX tq $uQ';s+[ \$]++g;s-j-P-;s^yyy^r^g;s:i:H:;s!X! !g;s|Z|n|;s*Q*J*;s{q}{s}g;s(f)(A);system(join('',Sub(split('',$i))),(joi n('',Sub(split(''); To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian Okay, I won't top-post unless it's an emergency Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: [Perl-Win32-Users]Subject Line
-Original Message- From: Jack [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 4:42 PM To: Perl-Win32-Users Subject: Re: [Perl-Win32-Users]Subject Line - Original Message - From: Stovall, Adrian M. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, November 22, 2002 3:30 PM Subject: RE: [Perl-Win32-Users]Subject Line Is it really any harder than filtering on perl-win32-users in the To: field? Yes. The 'To:' field may contain any aliases the user set up; which might not be 'perl-win32-users'. How about keeping the subject line filter; but shorten it! such as [PWU] or [Win32] us 'hotmailers' would thank you ! Actually, the filter *should* look at what's in the e-mail header, regardless of any aliases the user has set. Look under Advanced Filtering, and choose the options for If To or CC Lines contains perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: use LWP; -- problem with URL
Title: Message double-quotes was a good start...try this: my $url="http://mysite.com/refers".$month."02.html"; it's looking for a variable called $month02, and not finding it. -Original Message-From: Ricci, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, November 08, 2002 12:47 PMTo: [EMAIL PROTECTED]Subject: use LWP; -- problem with URL Hello, I'm using LWP to access urls for the past twelve months, so I want to automate the script so that is it will hit months 1-12. The problem appears to be in the single quote (') that is encasing my url string. my $url=" 'http://mysite.com/refers$month02.html'; I get this error: 404 Not FoundThe requested URL /refers$month02.html was not found on this server This makes sense, since the single quotes will make the $month variable part of the string. If I change the statement to: my $url=" "http://mysite.com/refers$month02.html"; Using double quotes. I get this error: 404 Not FoundThe requested URL /refers.html was not found on this server This doesn't make sense, since the double quotes should allow the variable $month to represent its current value. It's also taking out the 02. What am I missing. This shouldn't be difficult. Thanks in advance, Mark This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. Any review, use, disclosure or distribution by persons or entities other than the intended recipient(s) is prohibited. If you are not the intended recipient, please contact the sender by reply and destroy all copies of the original message. Thank you. WordWave, Capturing the Power of the Spoken Word http://www.wordwave.com
RE: Hash tables where keys names would not be stored
Maybe a two-part solution...use the md5 to create both a hash entry and a record in some kind of mini-database (one table, two columns...MD5 and URL). Then when you want to display stuff later, you look for the associated URL from the database...lots of ways to go about this...you can have this be simple, fast, or memory-efficient...pick two... (old quote re-warmed) -Original Message- From: Thomas Drugeon [mailto:tdrugeon;ina.fr] Sent: Wednesday, November 06, 2002 11:39 AM To: Arms, Mike; [EMAIL PROTECTED] Subject: Re: Hash tables where keys names would not be stored I am am actually storing more than 100,000 Urls, from different hosts (I am doing a crawler, supposed to crawl big sites or small parts of web) So removing the base would be a good idea if there was a known number of hosts, but in my case it would be ackward. The problem is that a URL can be 10 chars long to more than 200, so their storage is not really efficient. I am using tied hashes to DBM files, and I can clearly see the difference in size between the $seen{md5($url)} version and the normal $seen{$url} when going up to more than 50,000 Urls. When using the md5, I cannot list URLs using keys or each, but I don't need it. I am looking for a more elegant way to do this - Original Message - My first question is why not store the full URL in your hash? Is this optimization of memory really important? I can see it would be important if you are storing over 100,000 URLs, but this seems unlikely. If the optimization is really needed and if all of the URLs have a common base, then you could remove the base from each before sticking it in the hash. You could store the base in a scalar if needed. Now to your question of testing for existence of a key in a hash, we use the exists function: sub been_there ($) { # argument is the URL (or whatever key you are using) return exists $seen{$_[0]}; } To mark a URL as visited, you would just do something like: $seen{$key} = 1; where $key is the URL or whatever key you are using. -- Mike Arms -Original Message- From: Thomas Drugeon [mailto:tdrugeon;ina.fr] Sent: Wednesday, November 06, 2002 3:10 AM To: [EMAIL PROTECTED] Subject: Hash tables where keys names would not be stored Hello, I am using hash table to know if a URL has already been seen, but I don't care about functions like each or keys: I just want to know if a given URL is already in it, that's all. I don't want to store all those urls in full text! So I am using md5 digest to compress the URL, like return 0 if $seen{md5($url)}; This results in a smaller Hash in memory, but using a hash algorithm on a hash is quite irritating... Do you know any other way, or Tie class, to do this in a smarter and more efficient way? Thanks in advance, Thomas ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Trimming Leading and Trailing Whitespaces
$string = cat and dog; $string =~ s/^\s+(.*)\s+$/$1/; -Original Message- From: Stephens, Wes (N-Sybase) [mailto:wes.stephens;lmco.com] Sent: Wednesday, October 30, 2002 11:44 AM To: ActivePerl (E-mail); Perl-Win32-Users (E-mail) Subject: Trimming Leading and Trailing Whitespaces Is there a string manipulation function to automatically trim leading and trailing whitespaces? For example: Problem: $string =cat and dog ; Objective: $string = cat and dog; Thanks, Wes ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Passing multiple hashes into a sub-routine and returning them
foreach $key (keys %hash) { print key: $key - value: $hash{$key}\n; } The code above loops through the keys (in no particular order) and prints each key along with its value. -Original Message- From: Reddy Kankanala [mailto:rkankanala;Interelate.com] Sent: Tuesday, October 29, 2002 11:04 AM To: Thomas Drugeon; [EMAIL PROTECTED] Subject: RE: Passing multiple hashes into a sub-routine and returning them when you loop thru keys, is there a way to get the corresponding value? -Original Message- From: Thomas Drugeon [mailto:tdrugeon;ina.fr] Sent: Tuesday, October 29, 2002 10:39 AM To: [EMAIL PROTECTED] Subject: Re: Passing multiple hashes into a sub-routine and returning them hashes and other types are always passed by reference for example if you modifie $_[0], it will modifie the original variable passed to the function so if you want to modified %a and %b, you just need to do: func(%a,%b); sub func { my $a_ref = shift; my $b_ref = shift; foreach (keys %{$a_ref}) { do smething... } } if you want to return to different hashes, you will ahave to use references that way: ($ref_a, $ref_b) = func(%c, %d); # %{$ref_a} is a hash # $$ref_a{something} should also work sub func { ... return \%c, \%d } - Original Message - Please can someone help me with the above? Basically what I want to do is something like this: (%a, %b) = func(%a, %b); Where I am passing two hashes into the function func, modifying their contents within it an returning them. If I pass the hashes in by reference, how do I access them in func? Thanks, Phil. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Logging in
Without knowing whether there is data in $password, it's hard to say what the problem is. Your error message seems to point to the line comparing $data and $password, so the best test would be to print out these two values before that line. print \$password=$password\n; print \$data=$data\n; Then you'll know which one is empty. -Original Message- From: Issa Mbodji [mailto:issambodji;yahoo.com] Sent: Tuesday, October 22, 2002 5:22 PM To: Stovall, Adrian M. Subject: RE: Logging in Hello Adrian: Here is my code: use DBI; use DBD::ODBC; use warnings; use strict; use CGI qw(:standard); my $data; my $user; my $password; $user = param (username); $password = param (password); my $dbh = DBI-connect(dbi:ODBC:Registration9, , , {RaiseError=1}); my $sql = SELECT Password FROM Users WHERE UserName = ? ; my $sth = $dbh-prepare($sql); $sth-execute($user); $data = $sth-fetch; if ($data eq $password) { print (Something) } else { print (Something else) } and here is the error message I am getting: use of an uninitialized value eq Thanks for any help you can provide Mame Mbodji Stovall, Adrian M. [EMAIL PROTECTED] wrote: That is an extremely broad question. Why don't you post the code for your log-in page for starters...it's hard to help without knowing what's going on. Saying that you've tried everything, is like me telling a mechanic I looked all over, but I couldn;t find anything wrong with the enginewe need to look under the hood :) -Original Message- From: Issa Mbodji [mailto:issambodji;yahoo.com] Sent: Monday, October 21, 2002 8:37 PM To: [EMAIL PROTECTED] Subject: Logging in Hello: Does anyone understand how to authenticate a user from an Access database with 2 fields (username and password). The user is logging from an HTML form with 2 fields (username and password). I tried everything and it does not seem to work. Is there anything I need to do with the Apache server I am running? Any suggestion will be greatly appreciated. Mame Issa Mbodji 3201 Weeping Willow Ct # 33 Silver Spring, MD , 20906 Tel. (301) 603-0847 e-mail: [EMAIL PROTECTED] Do you Yahoo!? Y! Web Hosting - Let the expert host your web site Mame Issa Mbodji 3201 Weeping Willow Ct # 33 Silver Spring, MD , 20906 Tel. (301) 603-0847 e-mail: [EMAIL PROTECTED] Do you Yahoo!? Y! Web Hosting - Let the expert host your web site ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Can't access from Command Line
How about The First Annual Improvisational Perl Contest... -Original Message- From: Tillman, James [mailto:JamesTillman;fdle.state.fl.us] Sent: Wednesday, October 23, 2002 6:06 AM To: perl-win32-users Subject: RE: Can't access from Command Line Actually, I think this would be an extemporaneous Perl contest. Of course, real such contests would have to be held live, perhaps on IRC? ;-) jpt -Original Message- From: Stovall, Adrian M. [mailto:Adrian.Stovall;durez.com] Sent: Tuesday, October 22, 2002 5:29 PM To: perl-win32-users Subject: RE: Can't access from Command Line This is starting to sound an awful lot like a mildly obfuscated Perl contest... -Original Message- From: Thomas R Wyant_III [mailto:Thomas.R.Wyant-III;usa.dupont.com] Sent: Tuesday, October 22, 2002 4:18 PM To: perl-win32-users Subject: RE: Can't access from Command Line Burak - Unless, of course, the user opened DATA first! :-) Perverse example: C:\perl print Hello, sailor!\n; __END__ Hello, sailor! C:\perl while (DATA) {print Data $_} __END__ The bustard's a genial fowl Data The bustard's a genial fowl with minimal reason to growl. Data with minimal reason to growl. He escapes what would be Data He escapes what would be Illegitimacy Data Illegitimacy By means of a fortunate vowel. Data By means of a fortunate vowel. ^Z C:\ Tom Wyant Burak Gürsoy [EMAIL PROTECTED]@listserv.ActiveState.com on 10/22/2002 02:56:08 PM Sent by:[EMAIL PROTECTED] To:perl-win32-users [EMAIL PROTECTED] cc: Subject:RE: Can't access from Command Line btw, if you write __END__; and enter, perl will exit :) -Original Message- From: [EMAIL PROTECTED] [mailto:perl-win32-users-admin;listserv.ActiveState.com]On Behalf Of Tillman, James Sent: Tuesday, October 22, 2002 7:27 PM To: perl-win32-users Subject: RE: Can't access from Command Line When I go to the command prompt, I type C:\perl and the computer just sits there. Sounds normal to me...you didn't tell perl to do anything. How fitting. The perl executible is as lazy as the programmers who love it so much! ;-) jpt ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Can't access from Command Line
This is starting to sound an awful lot like a mildly obfuscated Perl contest... -Original Message- From: Thomas R Wyant_III [mailto:Thomas.R.Wyant-III;usa.dupont.com] Sent: Tuesday, October 22, 2002 4:18 PM To: perl-win32-users Subject: RE: Can't access from Command Line Burak - Unless, of course, the user opened DATA first! :-) Perverse example: C:\perl print Hello, sailor!\n; __END__ Hello, sailor! C:\perl while (DATA) {print Data $_} __END__ The bustard's a genial fowl Data The bustard's a genial fowl with minimal reason to growl. Data with minimal reason to growl. He escapes what would be Data He escapes what would be Illegitimacy Data Illegitimacy By means of a fortunate vowel. Data By means of a fortunate vowel. ^Z C:\ Tom Wyant Burak Gürsoy [EMAIL PROTECTED]@listserv.ActiveState.com on 10/22/2002 02:56:08 PM Sent by:[EMAIL PROTECTED] To:perl-win32-users [EMAIL PROTECTED] cc: Subject:RE: Can't access from Command Line btw, if you write __END__; and enter, perl will exit :) -Original Message- From: [EMAIL PROTECTED] [mailto:perl-win32-users-admin;listserv.ActiveState.com]On Behalf Of Tillman, James Sent: Tuesday, October 22, 2002 7:27 PM To: perl-win32-users Subject: RE: Can't access from Command Line When I go to the command prompt, I type C:\perl and the computer just sits there. Sounds normal to me...you didn't tell perl to do anything. How fitting. The perl executible is as lazy as the programmers who love it so much! ;-) jpt ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as E-Contract Intended, this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: what is this expr doing exactly?
It's checking to see if $self-{'Dir'} is defined... if it IS defined, it's looking at $currn, and saving any sequence of characters that are at the end of the string $currn, and do not contain a forward slash. Then it's replacing the contents of $currn with whatever was in $self-{'dir'} plus the saved portion of the string. If $self-{'Dir'} is NOT defined, it does nothing. -Original Message- From: Reddy Kankanala [mailto:rkankanala;Interelate.com] Sent: Tuesday, October 22, 2002 4:31 PM To: [EMAIL PROTECTED] Subject: what is this expr doing exactly? can some one tell me what is this doing? i found this in Logfile::Rotate $currn=~ s+.*/([^/]*)+$self-{'Dir'}/$1+if defined($self-{'Dir'}); Thanks. Reddy ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Sorting hash of a hash by value
Not to pick, but this seems like a good project to attach to a database of some sort...I don't know if that's within the scope of your solution, but if it is, it might be worth thinking about. -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 15, 2002 4:06 PM To: [EMAIL PROTECTED] Subject: Re: Sorting hash of a hash by value Erich C. Beyrent wrote: Also, it seems that when I sort and I come across duplicate entries (such as $arranger) they are not returned and I wind up with a short list. Nothing to do with the sort. You say you put stuff in a hash. Hash keys are unique, so you better rethink your choise of data structure :) /J Crap. Okay, no problem. The key can always be made to be unique, but what I need to do then is sort by value of a hash of a hash, which can be the same, such as $arranger and $composer. Here's what I am doing - I am opening a file, and reading each line to be split by a colon delimiter (this is all in a subroutine that returns the hash of a hash: sub get_data() # Split the line into its components my ($cat_num, $link, $name, $title, $composer, $arranger, $publisher, $price, $description) = split(/\:/, $_); The $cat_num is always unique, so I can use that for the key: my %HoH = (); $HoH{$cat_num}{'CATALOG'} = $cat_num; $HoH{$cat_num}{'LINK'} = $link; $HoH{$cat_num}{'NAME'} = $name; $HoH{$cat_num}{'TITLE'} = $title; $HoH{$cat_num}{'COMPOSER'} = $composer; $HoH{$cat_num}{'ARRANGER'} = $arranger; $HoH{$cat_num}{'PUBLISHER'} = $publisher; $HoH{$cat_num}{'PRICE'} = $price; $HoH{$cat_num}{'DESCRIPTION'} = $description; return (\%HoH); # END OF SUB So now, I need to get at these values to sort by them, but so far, I am only sorting by key: my $rHoH = get_data(); foreach my $record (sort ascend_alpha keys %$rHoH) { $cat_num = $rHoH-{$record}-{'CATALOG'}; $link = $rHoH-{$record}-{'LINK'}; $name = $rHoH-{$record}-{'NAME'}; $title = $rHoH-{$record}-{'TITLE'}; $composer = $rHoH-{$record}-{'COMPOSER'}; $arranger = $rHoH-{$record}-{'ARRANGER'}; $publisher = $rHoH-{$record}-{'PUBLISHER'}; $price = $rHoH-{$record}-{'PRICE'}; $description = $rHoH-{$record}-{'DESCRIPTION'}; } So how do I sort %$rHoH by value? There are examples in perlfunc man page under sort function. You will need to determine which fields you want to sort on, what kind of sort (alpha/numeric) and what order (forward/reverse). -- ,-/- __ _ _ $Bill Luebkert ICQ=162126130 (_/ / )// // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /-- o // // http://dbecoll.tripod.com/ (Free site for Perl) -/-' /___/__/_/_ Castle of Medieval Myth Magic http://www.todbe.com/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Regexp needed
Assuming you put each line in a variable called $line... @columns = split($line); Pretty simple, eh? @columns will have 8 elements (0-7) based on the data you provided. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 14, 2002 10:29 AM To: [EMAIL PROTECTED] Subject: RE: Regexp needed Hi, i have a file like this: . p167 bt1sqtf4 2720 1055adelevin 2002-10-14 11:21 p130 bt1sqtf4 1753 520 aginer2002-10-14 10:33 p143 bt1sqtf4 1658 518 alchippe 2002-10-14 10:30 p144 bt1sqtf4 1777 663 amaragou 2002-10-14 10:33 p175 bt1sqtf4 2976 1148ascatola 2002-10-14 11:30 p176 bt1sqtf4 3039 1164bceillie 2002-10-14 11:36 p135 bt1sqtf4 1224 503 blegrand 2002-10-14 10:07 p122 bt1sqtf4 4692 616 CAPTMA1 2002-10-14 09:53 p163 bt1sqtf4 2577 813 cfrancoi 2002-10-14 11:14 p154 bt1sqtf4 2200 914 chtuffre 2002-10-14 10:54 p146 bt1sqtf4 1848 589 cky 2002-10-14 10:35 p116 bt1sqtf4 4476 581 cvanlath 2002-10-14 09:42 .. How can i extract the 5 parameter ie the PID and put all in a an array? Thanks for your precious help. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How can I figure out whether it is binary file or ASCII file under one directory?
Can you be any more specific than various binary files? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 12:54 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: How can I figure out whether it is binary file or ASCII file under one directory? Dear all, A question, How can I figure out whether it is binary file or ASCII file under one directory using perl? Does perl have a function for that? I have a project to pick up various binary files from some directories. Thanks in advance! Have a nice day! Lixin ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Setting the actual directory with a Perl script.
That won't quite work... #!perl -w use Cwd; print cwd.\n; #print the starting directory system(cd c:\\temp\\);#use the system cd command print cwd.\n; #print the current directory (didn't change) chdir(c:\\temp\\);#change to c:\temp (insert the directory name of your choice) print cwd.\n; #print the current directory (changed as expected) Above is an example of what using the system cd command does. If you want to change the working directory of your perl script, use perl's chdir() function. -Original Message- From: Adam Ingerman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 8:05 AM To: [EMAIL PROTECTED] Subject: Re: Setting the actual directory with a Perl script. Hello, do you know a possibility to set the actual directory inside a Perl script (chdir my_dir;) to get it changed in the command shell outside the script? setDir.pl: # some code to set $MyDir chdir $MyDir; exit 0; Command line: setDir.pl Regards, Martin Kellner easiest way, tell the shell to do it for you. if you're on windows, #---code-- system(cd c:\\windows\\); #-- snip you can of course use a variable for your directory. and if you're using a different OS, or even if you have something better, like for example you want to use cdd or whatever, changing is easy. the system() command just executes a command on the shell. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Setting the actual directory with a Perl script.
That took a bit of thinking...Three lines: #!perl -w $chdir = c:\\winnt; #or whatever code you want to pick a directory system(start /B direct.bat $chdir); #go to that directory Sometimes it's easier to lean on dos commands than on perl commands (not very often, though). :) HTH Adrian cwd.bat -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 8:44 AM To: [EMAIL PROTECTED] Subject: Re: Setting the actual directory with a Perl script. Hello, thats not exactly the behaviour I wanted. Its a little bit complicated, because instead C:\test_cd.pl C:/ C:/ c:/temp C:\ I want to have C:\test_cd.pl C:/ C:/ c:/temp C:\temp\ (using your code as test_cd.pl). Regards, Martin Kellner |+--- || Stovall, Adrian M. | || [EMAIL PROTECTED] | || Gesendet von:| || [EMAIL PROTECTED]| || eState.com | || | || | || 25.09.2002 15:33 | || | |+--- --- -| | | | An: [EMAIL PROTECTED] | | Kopie: | | Thema: RE: Setting the actual directory with a Perl script. | --- -| That won't quite work... #!perl -w use Cwd; print cwd.\n; #print the starting directory system(cd c:\\temp\\); #use the system cd command print cwd.\n; #print the current directory (didn't change) chdir(c:\\temp\\);#change to c:\temp (insert the directory name of your choice) print cwd.\n; #print the current directory (changed as expected) Above is an example of what using the system cd command does. If you want to change the working directory of your perl script, use perl's chdir() function. -Original Message- From: Adam Ingerman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 8:05 AM To: [EMAIL PROTECTED] Subject: Re: Setting the actual directory with a Perl script. Hello, do you know a possibility to set the actual directory inside a Perl script (chdir my_dir;) to get it changed in the command shell outside the script? setDir.pl: # some code to set $MyDir chdir $MyDir; exit 0; Command line: setDir.pl Regards, Martin Kellner easiest way, tell the shell to do it for you. if you're on windows, #---code-- system(cd c:\\windows\\); #-- snip you can of course use a variable for your directory. and if you're using a different OS, or even if you have something better, like for example you want to use cdd or whatever, changing is easy. the system() command just executes a command on the shell. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
FW: Setting the actual directory with a Perl script.
Oops...forgot something... direct.bat--- cd %1 direct.bat--- Or: #!perl -w $chdir = c:\\winnt; #or whatever code you want to pick a directory system(start /B cd $chdir); #go to that directory I also found some strange side effects...typing cd \ (since I put my test script in my root dir) and perl direct.pl gives an error on subsequent executions: C:\perl direct.pl Can't open perl script direct.pl: No such file or directory ... -Original Message- From: Stovall, Adrian M. Sent: Wednesday, September 25, 2002 10:03 AM To: '[EMAIL PROTECTED]' Subject: RE: Setting the actual directory with a Perl script. That took a bit of thinking...Three lines: #!perl -w $chdir = c:\\winnt; #or whatever code you want to pick a directory system(start /B direct.bat $chdir); #go to that directory Sometimes it's easier to lean on dos commands than on perl commands (not very often, though). :) HTH Adrian cwd.bat -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 8:44 AM To: [EMAIL PROTECTED] Subject: Re: Setting the actual directory with a Perl script. Hello, thats not exactly the behaviour I wanted. Its a little bit complicated, because instead C:\test_cd.pl C:/ C:/ c:/temp C:\ I want to have C:\test_cd.pl C:/ C:/ c:/temp C:\temp\ (using your code as test_cd.pl). Regards, Martin Kellner |+--- || Stovall, Adrian M. | || [EMAIL PROTECTED] | || Gesendet von:| || [EMAIL PROTECTED]| || eState.com | || | || | || 25.09.2002 15:33 | || | |+--- --- -| | | | An: [EMAIL PROTECTED] | | Kopie: | | Thema: RE: Setting the actual directory with a Perl script. | --- -| That won't quite work... #!perl -w use Cwd; print cwd.\n; #print the starting directory system(cd c:\\temp\\); #use the system cd command print cwd.\n; #print the current directory (didn't change) chdir(c:\\temp\\);#change to c:\temp (insert the directory name of your choice) print cwd.\n; #print the current directory (changed as expected) Above is an example of what using the system cd command does. If you want to change the working directory of your perl script, use perl's chdir() function. -Original Message- From: Adam Ingerman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 8:05 AM To: [EMAIL PROTECTED] Subject: Re: Setting the actual directory with a Perl script. Hello, do you know a possibility to set the actual directory inside a Perl script (chdir my_dir;) to get it changed in the command shell outside the script? setDir.pl: # some code to set $MyDir chdir $MyDir; exit 0; Command line: setDir.pl Regards, Martin Kellner easiest way, tell the shell to do it for you. if you're on windows, #---code-- system(cd c:\\windows\\); #-- snip you can of course use a variable for your directory. and if you're using a different OS, or even if you have something better, like for example you want to use cdd or whatever, changing is easy. the system() command just executes a command on the shell. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com
RE: Outlook Express mail notifier...
And I would do the same...what my wife likes (or liked) about incredimail was the little always-on-top desktop icon that showed up when she had new mail. I guess it's easier to look over and see a 2 high cartoon anvil with the word Mail written on it sitting in the middle of the screen. Ahh, the things we do for love... -Original Message- From: Carl Jolley [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 12:17 PM To: Stovall, Adrian M. Cc: perl-win32-users Subject: Re: Outlook Express mail notifier... On Tue, 10 Sep 2002, Stovall, Adrian M. wrote: Hi all, as a favor to my wife, I am going to create a new mail notifier (something that plays a sound and puts a picture on the screen when mail shows up in outlook express). Incredimail sucks, and she finally realized that. At any rate, I was wondering if anyone could point me to some good documentation on any COM interfaces for Outlook Express. The other stuff won't be too hard, but finding out how to get particular info out of an MS app can be tough going sometimes. I'm not trying to discourage your use of perl but... If you simply go to Start/Settings/Sounds you should be able to select a sound that Windows will play for you when mail arrives. I downloaded the old AOL You've got mail sound clip (even though I don't use AOL) and set the New Mail Notification to use that mp3 file. [EMAIL PROTECTED] Carl Jolley All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Regualr Expression Again...
Make sure you chomp() the variable you're testing. You may have a newline character at the end of the string...that would make the expression not match. A quick test would be to change the expression to: $scandir =~ /\\\n$/ -Original Message- From: Barlow, Neil [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 8:53 AM To: 'Gould, Kevin'; [EMAIL PROTECTED] Subject: RE: Regualr Expression Again... Appollogies - I am looking to match \ at the end of the line - Have tried $scandir=~/\\$/ and am still not getting a match My input is C:\ Thanks for your help with this -Original Message- From: Gould, Kevin [mailto:[EMAIL PROTECTED]] Sent: 11 September 2002 14:45 To: [EMAIL PROTECTED] Subject: RE: Regualr Expression Again... It almost looks like you're working on a backslash, not a forward slash - which did you intend? I presume that's all you want to match, you are ONLY looking for the forward slash on the end of the line? $scandir=~/\/$/; or my preference, $scandir=~!/$!; -Original Message- From: Barlow, Neil [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 8:38 AM To: '[EMAIL PROTECTED]' Subject: RE: Regualr Expression Again... Thanks for your input for the last question. I am trying to complete a pattern match (Determining if the string ends in a forward slash) and can't get it to work at all using: $scandir =~ /\Z\\/ I have also tried $scandir =~ /$\\/ I can get it to match at the beginning of a string using \A Can anyone advise on what I am doing wrong? I really really really appreaciate your help with this.. Regards, Neil Barlow -Original Message- From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 15:15 To: Barlow, Neil Subject: RE: Regualr Expression You're missing a few slashes... $dir =~ s/\\/\//g; Or (more clearly) $dir =~ s|\\|/|g; To use a backslash in a matching expression and have it treated as a backslash (and not an escape sequence), you have to prefix it with another backslash. If a forward-slash is the delimiter for your expression, you have to prefix any forward slash in your expression with a backslash, too. It becomes a kind of hell... Your regex says s/\///g; or replace every forward-slash with nothing at all (delete them) -Original Message- From: Barlow, Neil [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 9:05 AM To: [EMAIL PROTECTED] Subject: Regualr Expression Hi all, I am dealing with directories and I read somewhere that it is best to use / rather than \ when dealing with directories. In order to cover my back - I am attempting to parse the string and replace any \ with / using the following: print Please enter directory to search: ; # directory prompt chomp($dir = STDIN); $dir =~ s/\///g; But the regular expression is not replacing the slashes - can anyone assist on this I really appreciate your input Regards, Neil Barlow ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Regualr Expression Again...
Please ignore my previous post and my most recent lapse in useful thought... -Original Message- From: Joseph P. Discenza [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 9:30 AM To: Barlow, Neil; 'Gould, Kevin'; [EMAIL PROTECTED] Subject: RE: Regualr Expression Again... Barlow, Neil wrote, on Wednesday, September 11, 2002 9:53 AM : I am looking to match \ at the end of the line - : Have tried $scandir=~/\\$/ and am still not getting a match : My input is C:\ perl -e $r=qq(c:\\);print qq(yay\n) if ($r=~/\\$/); prints yay; same if $r=qq(c:\\\n). (Someone suggested that a trailing newline could be your problem; it certainly isn't. Are you absolutely sure your input is C:\? Can you print it out before the match? Joe == Joseph P. Discenza, Sr. Programmer/Analyst mailto:[EMAIL PROTECTED] Carleton Inc. http://www.carletoninc.com 574.243.6040 ext. 300fax: 574.243.6060 Providing Financial Solutions and Compliance for over 30 Years * Please note that our Area Code has changed to 574! * ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Outlook Express mail notifier...
Hi all, as a favor to my wife, I am going to create a new mail notifier (something that plays a sound and puts a picture on the screen when mail shows up in outlook express). Incredimail sucks, and she finally realized that. At any rate, I was wondering if anyone could point me to some good documentation on any COM interfaces for Outlook Express. The other stuff won't be too hard, but finding out how to get particular info out of an MS app can be tough going sometimes. Thanks To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. Adrian ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Regualr Expression
You're missing a few slashes... $dir =~ s/\\/\//g; Or (more clearly) $dir =~ s|\\|/|g; To use a backslash in a matching expression and have it treated as a backslash (and not an escape sequence), you have to prefix it with another backslash. If a forward-slash is the delimiter for your expression, you have to prefix any forward slash in your expression with a backslash, too. It becomes a kind of hell... Your regex says s/\///g; or replace every forward-slash with nothing at all (delete them) -Original Message- From: Barlow, Neil [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 9:05 AM To: [EMAIL PROTECTED] Subject: Regualr Expression Hi all, I am dealing with directories and I read somewhere that it is best to use / rather than \ when dealing with directories. In order to cover my back - I am attempting to parse the string and replace any \ with / using the following: print Please enter directory to search: ; # directory prompt chomp($dir = STDIN); $dir =~ s/\///g; But the regular expression is not replacing the slashes - can anyone assist on this I really appreciate your input Regards, Neil Barlow ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Regualr Expression
You mean will it store that info for you? Put the whole thing in parentheses, and assign it to a variable... $numberofchanges = ($dir =~ s/\\/\//g); This should have a count of how many times it changed a \ to a /. Got this straight out of Programming Perl, 2nd Edition page 73. -Original Message- From: Barlow, Neil [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 10:11 AM To: perl-win32-users Subject: RE: Regualr Expression Cheers, Can the regex expression below then be modified to find out if the number of slashes in the expression is greater than one? -Original Message- From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 15:16 To: perl-win32-users Subject: Regualr Expression You're missing a few slashes... $dir =~ s/\\/\//g; Or (more clearly) $dir =~ s|\\|/|g; To use a backslash in a matching expression and have it treated as a backslash (and not an escape sequence), you have to prefix it with another backslash. If a forward-slash is the delimiter for your expression, you have to prefix any forward slash in your expression with a backslash, too. It becomes a kind of hell... Your regex says s/\///g; or replace every forward-slash with nothing at all (delete them) -Original Message- From: Barlow, Neil [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 9:05 AM To: [EMAIL PROTECTED] Subject: Regualr Expression Hi all, I am dealing with directories and I read somewhere that it is best to use / rather than \ when dealing with directories. In order to cover my back - I am attempting to parse the string and replace any \ with / using the following: print Please enter directory to search: ; # directory prompt chomp($dir = STDIN); $dir =~ s/\///g; But the regular expression is not replacing the slashes - can anyone assist on this I really appreciate your input Regards, Neil Barlow ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: PerlApp
I think what you want to do is create an application that accepts html input and does something with it. In this case, you'd first have to add that functionality to your program (and tell it to listen to a particular IP address and port...say 127.0.0.1:65123). Then you could create some kind of page that accepts the commands you pass it (say 'command.xxx')write your link as a href=http://127.0.0.1:65123/command.xxx?command=do_this;. Another approach to this would be to use Perl::Tk or Win32::GUI to create the front-end for your application, and skip the html interface. Either way is going to require a fair amount of adjustment. -Original Message- From: Brad Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 29, 2002 1:06 PM To: [EMAIL PROTECTED] Subject: PerlApp I would like to use PerlApp to create a freestanding web-based application. So far, when the app is started, it uses Win32::OLE to open a browser window (MSIE), and pass it the first page, a frames page named main.html. Now, MSIE serves as my application window. I would like to be able to click links in the browser window, which would make a call to my_app.exe, and the my_app.exe would send back the corresponding information to the browser window. Right now, though, I can't seem to get it to work, since the web browser window wants to save/open the .exe from the hyperlink. I worried that this would happen in certain cases, like those people who have auto-downloaders installed, but I did not expect it not to work at this primary point. So, in the browser window, the hyperlink URL would read: a href=my_app.exe?command=do_this where 'my_App.exe' is the application I created using PerlApp, and 'coomand=do_this' is the argument I am passing. Is it just a syntax in the way I am passing the arguments? Thanks in advance for your help. Brad Smith ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
AMENDMENT: How to find out the Perl build, not the version?
From perlvar: $PERL_VERSION $^V The revision, version, and subversion of the Perl interpreter, represented as a string composed of characters with those ordinals. Thus in Perl v5.6.0 it equals chr(5) . chr(6) . chr(0) and will return true for $^V eq v5.6.0. Note that the characters in this string value can potentially be in Unicode range. This can be used to determine whether the Perl interpreter executing a script is in the right range of versions. (Mnemonic: use ^V for Version Control.) Example: warn No \our\ declarations!\n if $^V and $^V lt v5.6.0; See the documentation of use VERSION and require VERSION for a convenient way to fail if the running Perl interpreter is too old. See also $] for an older representation of the Perl version. -Original Message- From: Stovall, Adrian M. Sent: Wednesday, August 28, 2002 8:28 AM To: [EMAIL PROTECTED] Subject: RE: How to find out the Perl build, not the version? Do perl -V, instead of perl -v (capitalize the v). The first line should read something like: Summary of my perl5 (revision 5 version 6 subversion 1) configuration: Grab that line and do some massaging... -Original Message- From: Smith, Barry [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 28, 2002 8:14 AM To: [EMAIL PROTECTED] Subject: How to find out the Perl build, not the version? I can get the build version by looking at $], but I'm interested in the actual build version as in 522? Are there any special variable that I can access? Any suggestions on how I can find this apart from doing perl -v and parsing out the build number? This message is for the named person's use only. It may contain sensitive and private proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you are not the intended recipient, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. CREDIT SUISSE GROUP and each legal entity in the CREDIT SUISSE FIRST BOSTON or CREDIT SUISSE ASSET MANAGEMENT business units of CREDIT SUISSE FIRST BOSTON reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Dial-up connection info...
I haven't posted here in a while, but I can think of no better place to ask this question (posted on perl-beginners[PBML] with no bites). Does anyone know a simple or relatively straightforward way to determine phone number and connection speed for an active dial-up connection? I've peeked at the modules Win32::RASE (doesn't seem to work very well), and Win32::RasAdmin (haven't looked in-depth yet, but doesn't seem to be the type of module I need). I'll roll my own in the absence of an existing module, but I don't want to reinvent this particular wheel if I don't have to. Any pointers are appreciated. Adrian Stovall ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs