RE: in a regex- re-arrange $1..$n

2004-10-12 Thread West, William M
>Are you thinking of : > >( $a1,$b1,$a2,$b2,$a3,$b3,$a4,$b4,$a5,$b5 ) = $_ =~ /regexp/ ? that might be what i need- if i'm going to be working with these values alot, then i want to know what they are at the outset > >The result of a regexp ($1..$9) are returned in array context, so you c

RE: in a regex- re-arrange $1..$n

2004-10-11 Thread West, William M
>-Original Message- >From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] >Sent: Monday, October 11, 2004 3:14 PM >To: West, William M; [EMAIL PROTECTED] >Subject: Re: in a regex- re-arrange $1..$n > >> the following is an as yet incomplete regex that i&#

in a regex- re-arrange $1..$n

2004-10-11 Thread West, William M
the following is an as yet incomplete regex that i'm working on: $data = $_ =~ s/<(name)>(.*?)<(desc)>(.*?)<(copy)>(.*?)<(license)>(.*?)<(entry)>//xg every other capture ($1 $3 $5 $7 $9) is going to be used one way, the other captures will be used differently... i'm wondering if there's a way t

RE: pass a filehandle then use it in grep{}?

2004-10-08 Thread West, William M
>Right. readdir() expects a DIRHANDLE as the argument, while grep() >expects a LIST as the second argument. > >> which is fine- my careless reading of my other code got the misuse >> of <> stuck in my head- that kept me from seeing the proper >> solution. > >Make it a habit to study the docs for

RE: pass a filehandle then use it in grep{}?

2004-10-08 Thread West, William M
> Gunnar Hjalmarsson wrote: >>> William M West wrote: @creds = grep {/./} $fh; >>> >>> Try: >>> >>> @creds = grep {/./} <$fh>; >> >> ah!! i was so used to that /not/ being the case with a normal >> filehandle > >Don't understand. Which syntax(es) are you referring to when s

RE: pass a filehandle then use it in grep{}?

2004-10-06 Thread West, William M
>> @creds = grep {/./} $fh; > >Try: > > @creds = grep {/./} <$fh>; > >-- >Gunnar Hjalmarsson >Email: http://www.gunnar.cc/cgi-bin/contact.pl ah!! i was so used to that /not/ being the case with a normal filehandle that i didn't think to use it with a reference *laugh* thank

pass a filehandle then use it in grep{}?

2004-10-06 Thread West, William M
this does not work: sub extract{ #retrieve subset of data from a single file #return that data in a list context my $fh = shift; #filehandle reference my @creds; local $/ = ''; @creds = grep {/./} $fh; @creds } this does work:: sub extrac

RE: speed of grep{s///} vs ??? or am i asking the wrong question?

2004-10-05 Thread West, William M
>-Original Message- >From: Bakken, Luke [mailto:[EMAIL PROTECTED] >Sent: Monday, October 04, 2004 5:06 PM >To: West, William M; [EMAIL PROTECTED] >Subject: RE: speed of grep{s///} vs ??? or am i asking the wrong question? > >Try this, you don't need to shell o

speed of grep{s///} vs ??? or am i asking the wrong question?

2004-10-04 Thread West, William M
here's what works for me so far: #!/usr/bin/perl use strict; use warnings; sub get_subdirectories{ # retrieves list of directories from passed directory # returns directory list as an array my $directory = shift; open LS, "ls -l $directory|"; local $/ =

RE: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-04 Thread West, William M
>William> My impression was that OO in Perl has historically been fraught >with >William> CPU overhead - this will change in Perl 6? (argument number 2) > >FUD FUD FUD. > >*All* late binding takes a bit of time. Perl caches what it can. > well, i'll be a mother's son! I figured that Perl had

RE: sum a column

2004-10-01 Thread West, William M
> >But I didn't say that about the script author, and you claim to be the >script author, so what's the problem? > >-- >Gunnar Hjalmarsson >Email: http://www.gunnar.cc/cgi-bin/contact.pl looks like a communications problem... "The script author does have a clue about programming." is easy to

RE: Becoming Disenheartened - Everyone talks about Python and says Perl is old news.

2004-10-01 Thread West, William M
>With this willing to treat everything as object you end up with >Ugly code such as the following: >http://www.python.org/cgi-bin/moinmoin/CgiScripts (code snipped to save space) i found the Python script to be very readable- i am far more comfortable with Perl syntax, but it worked for me. I t

substitution and assignment fun ( was RE: Becoming Disenheartened )

2004-10-01 Thread West, William M
> >Python and Ruby don't write the code for me. But look at this Python code: > >s = "I am Perl guru"; >new_s = s.replace("Perl", "Python"); i always had trouble doing this in perl- just worked around it- then realized that this shouldn't be hard when reading your post... so i played... $s = "

RE: feeding standard input calling an external program

2004-09-07 Thread West, William M
willy http://www.hackswell.com/corenth > >> #try this: system("echo \'$xml\' | myprogamname") >> >> \ i haven't tried it, but it >> should keep the shell from interpolating the xml data > >But what happens if the XML has a

RE: feeding standard input calling an external program

2004-09-07 Thread West, William M
> > >One way to do this -- probably not a good one -- might be > > system("echo $xml | myprogamname") > >but if there's anything in the XML that the shell finds interesting, >this could fail in all kinds of spectacular ways. #try this: system("echo \'$xml\' | myprogamname")

RE: Reading hex data from file.

2004-08-19 Thread West, William M
>Hi, >Among other data, a binary file contains the bytes "00A5". >I am trying to read these four bytes and get the decimal equivalent as - $POST_DATA =~ s/(\w\w)/chr (hex($1))/eg; this is a line from one of my programs where i send data from another program in the form of argueme

RE: C Compiler

2004-08-04 Thread West, William M
> >Any recommendations on a c compiler to run on a Sun Sparc box? > >Rob this is bordering on off-topic, but since a compiler is useful for certain Perl modules, go get gcc http://gcc.gnu.org/install/binaries.html this is a page to get gcc when you can't compile it yourself. now, i didn't

RE: question about ( () if () ) while ();

2004-08-03 Thread West, William M
>Check 'perldoc perlsyn'. It explains that the "statement modifiers", >things like '... if CONDITION' and '... while CONDITION' are only allowed >after *simple* statements -- what they really should say is "expressions". > >You're allowed to write > > print 1 if /willy/; > >because 'print 1' is

question about ( () if () ) while ();

2004-08-03 Thread West, William M
$ perl -e ' $entry = "willy"; (print "1") if (/$entry/) while ($_ = "will"); print "0"' syntax error at -e line 1, near ") while" Execution of -e aborted due to compilation errors. seperating the bits seems to work. it seems to break down when i want to use the if statement in combination wit

RE: Perl <-> Expect

2004-07-15 Thread West, William M
>> >> >>Hi, >> >> >I need to telnet some hosts automatically without supplying password. >> >I can do it with Expect but I hardly know the language. >> >I wonder what you think of the Perl module Expect - if it's any good and >> >easy to use. >> >Also if you can think of another way to do the job t

RE: Pop up calendar

2004-07-12 Thread West, William M
>On Mon, 12 Jul 2004 00:29:52 -0700 (PDT), [EMAIL PROTECTED] (Melis >Mutlu) wrote: > >>Hi, >> >>I have a form with a date field (created by >>CGI::Quickform). I would like to add a pop up calendar >>so I can pick dates easily. Does anybody know how I >>can do that? Is there any module I can use f

Mail Server in Perl on Win32 platform.

2004-06-08 Thread West, William M
Am trying to get Activestate Perl to run a Mail server... been searching CPAN and found Net::Server::Mail::SMTP. the line: my $smtp = new Net::Server::Mail::SMTP socket => $conn; gives me the error: -- Can't locate object method "new" via package "Net::Server::Mail::SMTP" at testserver3.pl line

RE: installing perl module without root permission

2004-05-03 Thread West, William M
>gohaku> What if perldoc is not included for some reason? > >All perl distros (except macperl for os 9) in the past eight years >or so have "perldoc". oddly enough- my Knoppix install does not... i'll have to remedy that someday... willy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additio

RE: Replace ' ???

2004-04-27 Thread West, William M
> >I have a function and can't seem to get this figured out. I have >apostrohe's in the file that I am pulling down, however I need to remove >all >of the apostrophe's from the file before putting the file into the system. 1. I'm not sure if ' has to be escaped when in a regex... so try one the

RE: Improving performance when working with large text files

2004-03-12 Thread West, William M
> >Price, Jason wrote: >> I'm trying to optimize a script used for processing large text log >> files (around 45MB). I think I've got all the processing fairly well >> optimized, but I'm wondering if there's anything I can do to speed up >> the initial loading of the file. oh the pain and suf

RE: ways I might parse data in perl and give it to a telnet sessi on

2004-02-19 Thread West, William M
>Is there any separate reason to use 'expect' Perl will happily >talk telnet and ftp on its own. > >Rob well- namely that it works- i honestly don't know /how/ to get perl to talk telnet *laugh* i guess the proper module would help. i will investigate this possibility and see what happens :)

ways I might parse data in perl and give it to a telnet session

2004-02-18 Thread West, William M
definitions:: 'cuecat' is a barcode reader 'expect' is a scripting language that lets you automate actions with interactive programs such as 'ftp' or 'telnet'. what i am trying to do:: 1 translate c

RE: skipping lines of input from another program...

2004-02-09 Thread West, William M
> >I think you have an over-elaborate design for this anyway. I think it's >likely that your data can be processed better than just by skipping 'n' >lines between useful records. And even if this is the way you want to go >there's nothing wrong with well- my design is likely not that great over

RE: skipping lines of input from another program...

2004-02-06 Thread West, William M
in the post that i am now replying to, i said that i couldn't get the program to skip lines as it parsed through the output of another program. i have "solved" the problem- but i do not know WHY this works the way it does. this worked great :) (thanks to drieux) - in fact, it would let

skipping lines of input from another program...

2004-02-06 Thread West, William M
the following is my script that i am working on- it fails to do quite the right thing.. qouting from one of the comments below:: "#skip_lines() is supposed to "skip" some lines of output. #The problem is, that it DOESN'T even though the debug print statement # "print "trash is $trash \n

RE: $PATH/expect_scripts/script.exp | $PATH/perl/script.pl

2004-02-04 Thread West, William M
i feel silly. with regard to pipe catching:: while () { print " $_, is a lovely string\n"; } well, there's a simple answer to a simple question... willy :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

$PATH/expect_scripts/script.exp | $PATH/perl/script.pl

2004-02-04 Thread West, William M
the subject describes my wishes. what i really want to do is parse the screens of an expect script through a perl script... now, what i would like to do is understand how to catch a pipe in perl, and how my program will end up being different. I looked up pipe in 'perldoc -q pipe' and 'perldoc

RE: copying complex data structures

2003-12-12 Thread West, William M
>use Storable; >$arrayref_one = dclone( $arrayref_two ); > aha thanks :) it's those details that make a program so much easier to make.. i noticed another poster asking about reference notations- i think that this and Object Oriented programming have given me the most headaches on a co

copying complex data structures

2003-12-11 Thread West, William M
the following will not work: $arrayref_one = $arrayreftwo; #it's just making a new name for the same #reference. the following works fine: foreach my $a (0..$what){ foreach my $b (0..$why){ $arrayref_one->[$a]->[$b] = $arrayref_t

use of File::Find

2003-11-06 Thread West, William M
find (\&transfer, $path); sub transfer { my ($newpath, $oldstring, $newstring) = @_; otherstuff ($oldstring, $newstring); # etc... } now- how do i pass parameters to transfer() when it's called with find?? i want the recursive fileprocessing to change file contents an

RE: help if than else statement

2003-09-04 Thread West, William M
>The "==" operator checks two numeric values for comparison, returning true >if they match >The "eq" operator checks two string values for comparison, returning true >if >they match oh dear!! i'd forgotten that detail. sometimes i still get myself with this one. willy -- To unsubscribe, e-mai

RE: help if than else statement

2003-09-04 Thread West, William M
> >Can some one tell me way this does not work. > > > >if (@ARGV[0] = "-q"){print "it worked\n";} try (@ARGV[0] == "-q") ^^ this got me too- the "==" compares values while "=" assignes the right side value to lef

data recovery ext3 (was RE: Recover zip file via Archive::Zip)

2003-08-14 Thread West, William M
> >Hello everyone, __snipped stuff to do with zipped files___ >While I'm still off topic and speaking of data recovery, has anyone >every recovered data from a ext3 filesystem after all utilities have >been tried to repair them? I've tried all the utilities off of >freshmeat.net and nothing wor

data recovery ext3 (was RE: Recover zip file via Archive::Zip)

2003-08-14 Thread West, William M
>While I'm still off topic and speaking of data recovery, has anyone >every recovered data from a ext3 filesystem after all utilities have >been tried to repair them? I've tried all the utilities off of >freshmeat.net and nothing works. I've got bad blocks and i-nodes. Any >suggestions are wel

RE: data recovery ext3 (was RE: Recover zip file via Archive::Zi p)

2003-08-08 Thread West, William M
>From: Tassilo von Parseval [mailto:[EMAIL PROTECTED] >Subject: Re: data recovery ext3 (was RE: Recover zip file via Archive::Zip) > >On Thu, Aug 07, 2003 at 03:09:06PM -0400 West, William M wrote: >> >> i am not sure what all the components do anymore- i did not docume

RE: data recovery ext3 (was RE: Recover zip file via Archive::Zi p)

2003-08-08 Thread West, William M
>> now that i've looked at it, it's really for getting to files that are >> unlinked etc. so i am not sure it will do you any good. > >Partly it might. The only problem with your script is that it cannot >deal with data that is spanning more than 12 inodes (those were usually >not in one block

RE: xor - i just don't understand *sigh*

2003-07-29 Thread West, William M
from Gary Stainburn: >> print "xor1" if ($a = $a) ^ ($b = $c); > >Presumably this is because you're using the assignment operator and not the >comparison operator. > >print "xor1" if ($a == $b) ^ ($b == $c); interesting.. a '=' seems to work fine in an 'and' or 'or' statement-- using 'xor' in pl

RE: a hash reference is not a hash-> lesson learned the hard way. ..

2003-07-29 Thread West, William M
>> just want to share with other unwary folk the pitfalls >> of making an assumption about perl (or anything for that matter) >> >> > >You are definitely correct a hash reference is not a hash, its a reference >:-). Specifically to a hash > >> >> i tried for the longest time to get something li

xor - i just don't understand *sigh*

2003-07-28 Thread West, William M
#!/usr/bin/perl -w use strict; use diagnostics; my $a = 1; my $b = 2; my $c = 2; my $d; print "xor1" if ($a = $a) ^ ($b = $c);#prints print "xor2" if ($a = $b) ^ ($b = $c);#no print print "xor3" if ($a = $b) xor ($b = $c);#no print print "xor4" if ($a = $a) xor ($b = $c);#no prints print "x

a hash reference is not a hash-> lesson learned the hard way...

2003-07-23 Thread West, William M
just want to share with other unwary folk the pitfalls of making an assumption about perl (or anything for that matter) i tried for the longest time to get something like the following to work:: foreach $section (keys %board){ for my $a (1..19){ for (1..19){

scope of variable carrying 'for ($n1..$n2){}'

2003-07-23 Thread West, William M
for (1..19){ for (1..19){ print $_ }} prints out the numbers 1 to 19 nineteen times... just curious how to access the outer forloop's variable from inside willy http://www.hackswell.com/corenth -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

Backup utility (was RE: concatonate to file?)

2003-06-16 Thread West, William M
#!/usr/bin/perl -w #simple tar archiver... something to make a cron job with #in the future :) #thanks for the info for strftime :) now can parse system time and #use it use POSIX qw(strftime); # still unclear about '-w' verses 'use warnings' use strict; use diagnostics; # where to put the a

concatonate to file?

2003-06-16 Thread West, William M
i'd like to take a couple of strings to concatonate to a path... here's my start the code::: #!/usr/bin/perl -w use strict; use diagnostics; my $date = `date`; #not sure about redirecting output to $path! $date=~s/( ){3}/; #i think this is proper to just take the string