Re: String manipulation problem

2003-03-12 Thread david
efully something like that will work for you: #!/usr/bin/perl -w use strict; my $i = 0; while(<>){ /DS_FILEVERSION/ && s/,(\d),(\d)/++$i % 2 ? ",$1,@{[$2+1]}" : ",@{[$1+1]},$2"/e; print; } __END__ david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Appending to a string

2003-03-13 Thread david
g like: #!/usr/bin/perl -w use strict; my @s = ("This_Text = 3","This_Text = 2"); for(@s){ print "Before: $_\n"; s/This_Text(.+)/$1=~m#^ = 2$# ? "$_:New_Text = 4" : "That_Text = 2"/e; print "After: $_\n"; } __END__ prints: Befor

Re: How to map hash keys only, not values?

2003-03-13 Thread david
.15 usr + 0.00 sys = 8.15 CPU) @ 12269.82/s (n=9) _foreach: 7 wallclock secs ( 8.16 usr + 0.00 sys = 8.16 CPU) @ 12254.78/s (n=9) _map: 20 wallclock secs (14.77 usr + 0.00 sys = 14.77 CPU) @ 6770.41/s (n=9) map is slow. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Regular Expressions http error code

2003-03-13 Thread david
wing should work: #!/usr/bin/perl -w use strict; while(<>){ m# HTTP / \d \. \d . \s (.+?) \s #x && print "$1\n"; } __END__ david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Fun with Regexes

2003-03-16 Thread david
eg/o); print "$_ does not match\n"; } __END__ prints: onetwothree matches threeonetwo matches onetwonope matches notthere does not match david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Help with Threads.

2003-03-18 Thread david
hat you load your modules (in question) per thread base (ie, during runtime via 'require' instead globally via 'use'). this gives each thread their own chances to clean up themselves after they are about to die. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: UNIX file system free space, used space, total space

2003-03-19 Thread david
\n"; print "used: ",$disk->used('/'),"\n"; print "available: ",$disk->avail('/'),"\n"; __END__ prints: total: 8589885440 used: 4378312704 available: 3775221760 david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Urgent: How do I find real file instead of link

2003-03-19 Thread david
$_ -> ",readlink,"\n" if -l; } __END__ david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Fork ?

2003-03-19 Thread david
2 child (29073 5) 3 child (29074 6) 4 child (29075 7) ... etc the output shows that each creation only allows 5 child processes to run. once this number is reached, the parent sleeps until some child has died and then start forking again. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: caller() problems

2003-03-20 Thread david
level caller tree. you can visualize the number as the index to the caller tree. a 1 means the second level of the caller. 0 means the first level of the caller tree. in fact, Perl's default array index machanism works the same way, 0 means the first element, 1 means the second element, etc. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Moving View of Months

2003-03-21 Thread david
for(sort { my($pmonth,$pyear) = $b =~ m#(.+)/(.+)#; my($month,$year) = $a =~ m#(.+)/(.+)#; $year cmp $pyear || $month cmp $pmonth } keys %range); __END__ prints: 04/2002 05/2002 06/2002 07/2002 08/2002 09/2002 10/200

C Beginners List? question, sorry,...

2002-07-24 Thread david
please forgive this su*perl*flu*ous question. This board is a great resource to try, ask, study and learn. Does anyone here know if there is such a board (a 'high' volume, daily archive, not just google groups/usenet) for the C Language and 'new' users in particular. I know, depending on who

Sorting a list by...

2002-08-10 Thread david
Well, being way down on the perl food chain, i interpreted (mis-interpreted?) this request a little different and offer a simplistic and not entirely correct approach but still i would like to offer it. It seemed to me that he was looking to split() the line into month | date | time | byte si

Re: comparing file dates from different servers

2002-08-20 Thread david
****** that's because you are access the file over the network and Perl's stat() function can't handle that. a simple solution would be to actually mount the drive to your local machine and then use the stat() function again. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Passing Hashes into a function

2002-08-20 Thread david
nd of understand why > this doesn't work. > > Thanks again for you help, > > John > change: my $hash_ref = @_; to: my ($hash_ref) = @_; but once you deference it and assign it to another hash like: my %hash = %$hash_ref; it's no longer acting on the hash ref. in

Re: how to make a regex for a ip address

2002-08-20 Thread david
$2 > 0 && $2 < 256 && $3 > 0 && $3 < 256 && $4 > 0 && $4 < 256) || warn("Invalid ip: $_\n"); david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: need help extracting words from a string

2002-08-20 Thread david
#!/usr/bin/perl -w use strict; open(FILE,'./datafile') || die("can't open ./datafile: $!\n"); #-- discard header #-- to remove the if checks inside the while loop to improve performance ; ; ; while(){ chop; my($schedule,$result) = (split(/\s+/))[-2,-1]; print "$schedule $result\n"; } close(FILE); david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: newbie question

2002-08-20 Thread david
when you assign something to it, it merely sets this bit to 0 or 1 but not actually assigne any value to it. just some thought... david Nikola Janceski wrote: > It's not a bug as I see it. You gurus must have told the compiler that $| > can only hold a 0 or 1 for whatever reason; &

Re: Global variables

2002-08-20 Thread david
#-- prints db print $DBString::user,"\n"; #-- prints user print $DBString::psw,"\n"; #- -prints psw for more info, check out perldoc david Dan Fish wrote: > What would be the preferred method of creating global variables that can > be > used in several different cgi scrip

Re: Help!! Retrieving Image File

2002-08-20 Thread david
t and than print the binary image. try it and see if it works or not. alos, use "\n\n" is better than "\r\n\r\n" because "\n\n" is more portable. you also don't need to binmode STDOUT david Perl wrote: > Hello All, > > I created a simple http upload file

Re: substituting a string in a file

2002-08-21 Thread david
Felix Geerinckx wrote: > on Wed, 21 Aug 2002 11:33:06 GMT, [EMAIL PROTECTED] wrote: > >> I'm trying to substitute all references to a date (of the format >> MMDD) in a file to the current date. I'm obviously doing >> something wrong here ('cause it doesn't work!:}), as no change is >> made

Re: Remove elements in an array from a different array

2002-08-21 Thread david
@h{@arr1}=(); delete @h{@arr2}; print join("\n",keys %h),"\n"; david Priss wrote: > Hello, > > I am very new to Perl, wonder if someone can help me > with this... if I have: > > @arr1 = qw (one two three four five); > @arr2 = qw (two four); > >

Re: Moving directories

2002-08-21 Thread david
do the following: mkdir "two"; chdir "two"; mkdir "one"; if you need to do something else, you need to move back to where you are after the second mkdir david David Richardson wrote: > Is there any way to have a perl script move one directory into > a

Re: Automate info retrieval

2002-08-21 Thread david
scheme the web site requires, the above might not work at all. check out libwww for more info. david Ed Andrews wrote: > How does one create a program to: > > 1. log into a secure web site which requires a username and password > 2. "click", or go to a specific web pag

Re: substituting a string in a file

2002-08-21 Thread david
e change. i will sure to keep that in mind and remember not to do that again. thanks for letting me know. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: AW: use Variable as a hashname?

2002-08-26 Thread david
x27;ip'} $_->{'interface'} $_->{'admin'}\n"; } if you need to add another entry to the @allmyrounters, you can do: push(@allmyrouters,{'ip'=>'3.3.3.3','interface'=>'interface3','admin'=>'admin3'});

Re: Forking question.

2002-08-26 Thread david
-- parent $child_process++; #-- one more process print "$pid created.\n"; }else{ #-- child handle_server($server); print "$server done. about to exit\n"; exit; } } i hope

Re: Forking question.

2002-08-26 Thread david
David wrote: > another thing: >> while ( $#server_list > -1 ) { > > this might never be true. i cut and paste too much! please ignore that! david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Regexp

2002-08-26 Thread david
Felix Geerinckx wrote: > on Mon, 26 Aug 2002 12:12:08 GMT, David Samuelsson wrote: > >> $_ comes in this form: >> >> servername:D:\CC_Storage\Views\EUSDNKG_Madeleine_Tae68_view.vws [uuid >> 74a6b3b0.d1cd11d4.896e.00:b0:d0:83:b4:9b] >> >> i

Re: Regexp

2002-08-26 Thread david
Felix Geerinckx wrote: > on Mon, 26 Aug 2002 19:01:27 GMT, David wrote: > >> Felix Geerinckx wrote: > >>> s/.*\[uuid (.*)\]/$1/; >> >> this might be a bit faster: >> >> /(\S+).$/ > > If you claim something is faster, prove it ;-) > (

Re: Regexp

2002-08-26 Thread david
ecasue i am lazy to type... believe it or not, my news reader do not allow(for some unknown reason) me to copy and paste outside of it's own window! david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Regexp

2002-08-26 Thread david
Robin Norwood wrote: > From david's headers: > > User-Agent: KNode/0.7.1 > > Time to change news readers, I think... :-) > > -RN > just curious. what news reader you guys are using? david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Regexp

2002-08-26 Thread david
is faster. for a longer string the search_replace appoach is faster. but in all cases, the substr appoach is faster(sometimes much faster) than the other appocach... nice to know. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Having problems with AppConfig::Getopt module

2002-08-26 Thread david
at? it means it should assign a hash reference to a hash. if you have -w turn on, you should see a warning. without -w, your %pagerdest will end up(silently) using the memeory address of the annom. ref as it's key and undef for it's value. how are you going to access 'karl'

Re: Regexp

2002-08-26 Thread david
master might not be happy. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Exported Vars

2002-08-26 Thread david
ad __END__ if you think about it. if Perl allows you to export something, change it and loads it again and again when different package refers to them. your data will be inconsistence. becuase one module will loads it, modify it, use it. another will again loads it, modify it and use it. in that case, you will have different things in different module. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Having problems with AppConfig::Getopt module

2002-08-26 Thread david
Karl Kaufman wrote: >> For example: >> >> # test.pl -pagerdest [EMAIL PROTECTED] is the above another typo? should it be: test.pl --pagerdest [EMAIL PROTECTED] you seem to have only one '-' in front of pagerdest? Getopt::Long uses '--' not '-&#

Re: is there any way to redirect a format to TK::Text

2002-08-27 Thread david
e <<"HEADER",$var1,$var2,$var3; -- @<<<<<<<<<< @<<<<<<<<<<<< @<<<<<<<<<<< -- HEADER #-- $header is formated now my $header = $^A; once you have $header, you can use it as a regular string anyway

Re: eval on a $SIG{KILL}- newbie question

2002-08-27 Thread david
;; } sub function{ die "whatever"; } sub another_function{ print shift; } if you don't like to use the eval{}, $@ stuff, you can set up a __DIE__ handler like: $SIG{__DIE__} = sub { }; david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: using Super in packages

2002-08-27 Thread david
thanks for the follow up and verify a ton of stuff. this is really nice. i don't totally understand your point a). can you provide your modules A.pm, B1.pm and C.pm? maybe that will clarify things a bit. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: LISTS OF LISTS - Help please!!

2002-08-27 Thread david
s: abcd which should be what you want right? :-) as i said before, this is not the best appoach. if you always want to search for a certain field(in your case, i think you are searching the Plex_Name field), you should index that field such as using a hash instead of an array.

Re: sorting logs

2002-08-27 Thread david
you might want to try: #!/usr/bin/perl -w use strict; my $i = 1; my $min = -1; while(<>){ my($n1,$d1,$b1) = /^INCREMENTAL\s+OF\s+(.+?)\s+.*?ON\s+(.+?)\s+.+\s+(\d+)$/i; $i++ if($b1 < $min); $min = $b1; print "\"$d1\",\"TAPE $i\&

Re: Exported Vars

2002-08-28 Thread david
Connie Chan wrote: > Thanks everybody, I've learn quite a lot in this lesson again. > Anyway, I still not up the OO level in Perl, so, quite sort of > information here I still need sometime to digest. > > Here is something I've simply test, but not confirm they are > right or not. > > When I pi

Re: Redirect STDOUT and SDTERR

2002-08-28 Thread david
you probably want to save STDERR before redirect it to STDOUT so that later you can change it back: open(OLD_ERR,">&STDERR"); open(STDOUT,">$log_full_name"); open(STDERR,">&STDOUT"); #-- code #-- restore STDERR open(STDERR,">&OL

Re: multiple concurrent processes

2002-08-28 Thread david
gt; you are forking a child, do a system() call, and execute some more code. depends on what the "" portion is, your child process might(if it doesn't exit) goes back to the for loop and start to fork it's own child. is that what you want? david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Checking for .jpg/.gif/.png files

2002-08-28 Thread david
se{ print "not gif\n"; } close(IMG); you can do pretty much the same thing to png file. just go to google, search for png specification, find out what the maigc id should look like and just code it according to the specfication. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how to be safe and secure

2002-08-29 Thread david
horrifying "listing" effect... you will put the config file somewhere restricted from outside access. of course, it probably doesn't stop anyone(other developers, users of your machine) whois using your system from opening the config file manually. david Brian Gilbert wrote: > I

Re: how to be safe and secure

2002-08-29 Thread david
O_RDWR|O_CREAT|O_EXCL,0777 || die $!; my $dsn = $hash{'dsn'}; my $user = $hash{'user'}; my $psw = $hash{'psw'}; my $db = new Win32::ODBC("fileDSN=$dsn; uid=$usr; psw=$psw"); #-- ...etc this way, auth.db became a binary file and thus can't be easi

Re: ifelsif/hash errors - question

2002-08-29 Thread david
e that this is the only error you have in your script). david Gregg O'Donnell wrote: > > Hey - I'm receciving syntax and global package errors in lines 540-550 of > this script, which is running on WinNT. One error I receive is for not > defining my hash "%countie

Re: ifelsif/hash errors - question

2002-08-29 Thread david
lock exit, your $county_abbrev will be destoried. so line 563 is bad since it tries to reference something that doesn't exist. 3. line 619: print $message ; tries to reference the $message variable that doesn't exist. another error. there might be more of those... didn't check the whole script... david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how to be safe and secure

2002-08-29 Thread david
this case. > > b) there is the ikky with the 'tie' that could > be having issues with the lack of parens > > tie (%hash,"NDBM_File","auth",O_RDWR|O_CREAT, 0640) || > die "problem with tie: $! \n"; > i like the parens too. :-) d

Re: uniq elements of an array

2002-08-30 Thread david
@unique = grep{!/$seen{$_}++/} @all_elements; > > But this does not even pass syntax check on windows > Can Anyone tell me the best way how to get all the unique elements in an > array preserving the same order why not simply: @hash{@all_elements} = (); now "keys %hash"

Re: Closures / Memory Usage

2002-09-03 Thread david
l this be called? return 3; } print function1(),"\n"; #-- what will be printed here? __END__ here you don't know what will be bound to the closure and thus can't be sure if your function[1-3] will be called. david Gfoo wrote: > Hello all... > > A question regard

Re: cookies and baking in general :)

2002-09-03 Thread david
out there that sets between a user's browser and your cgi script that makes your cgi script believe that the cookie is accept but your cookie is actually get deleted. checking a browser accepts cookie or not is thus unreliable and cumbersome. david Mariusz wrote: > How can I check if a us

Re: finding invalide options in getopt

2002-09-03 Thread david
rameter "hello" and the "WARNING WARNING" line is caused by the "--paul" invalid command line option which the script doesn't expect to catch. david Paul Tremblay wrote: > I would like to have my script print a short help message and then > quit if a

Re: locking a file in linux

2002-09-03 Thread david
is not 100%. what happen if your admin decided to use another editor than vi? no luck... however, i hope the above can provide you with something to get going... for all of the other locking modules you mention, your OS usually have to support the flock system call or they will not work(usually

Re: globally scoped variables changed

2002-09-03 Thread david
l you that). as far as user variable is concern, backticks doesn't change any of those. it's what you assign the output of backticks that matters. it that case, you can capture the output of backticks to anything you like including: my out local david backticks do not change any

RE: cookies and baking in general :)

2002-09-03 Thread david
Bob Showalter wrote: >> -Original Message- >> From: david [mailto:[EMAIL PROTECTED]] >> Sent: Tuesday, September 03, 2002 1:24 PM >> To: [EMAIL PROTECTED] >> Subject: Re: cookies and baking in general :) >> >> >> there are >> coo

Re: Simple useradd script problem

2002-09-03 Thread david
Darren Wanner wrote: > Simple add user script: > > #!/usr/bin/perl > > open(FILE,"users.log"); > @users=; > foreach $users (@users) { > `useradd -g 201 -d /userhome/$users -m $users`; > } > print "done.\n"; change: @users = ; to: chop(@use

Re: can someone explain this?

2002-09-03 Thread david
lines above or below this line, we might be able to help you figure out what it actually does. david Prachi Shah wrote: > Hi! > > I have this code written by someone and there's no documentation to it. I > am trying to figure what and how it works. There is this line right at

Re: Simple useradd script problem

2002-09-03 Thread david
John W. Krahn wrote: >> change: >> >> @users = ; >> >> to: >> >> chop(@users = ); > > > You should use chomp unless you are stuck in Perl4. > agree. chomp is safer(and faster than chop). david -- To unsubscribe, e-mail: [EM

Re: can someone explain this?

2002-09-03 Thread david
that doesn't reveal what: $Explanation = < ) ); #-- Alignment data does. can you again provide some code above this line? it start to look like a real syntax error to me unles the whole subroutine is really inside a pod. what happen if you: perl -c david Prachi Shah wrote: >

Re: locking a file in linux

2002-09-04 Thread david
include some of the more commonly used editors. david Wiggins D'Anconia wrote: > This is an interesting proposed solution. But as the poster pointed out > depends on whether they are *only* using vi, if that can be assured then > you might consider using the method by which vi do

Re: HELP !! displaying Associate Array value pairs

2002-09-04 Thread david
Quincy Ntuli wrote: > open(INVIN, "$sortedListing[$i]") or die "COULD NOT OPEN > $i\n"; > if the open is failing, you probably want to know why($! tells you why): open(INVIN, $sortedListing[$i]) or die "COULD NOT OPEN $i: $!

Re: Building SQL statement

2002-09-04 Thread david
what you thing it should be. simply remove the single quote around your $Var1, $Var2, $Var3 ... etc and try again. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Newbie question - Can smtp send attachments?

2002-09-04 Thread david
ble, you need to declare it. the 'use strict' thing enforce that. change: $msg = MINE::Lite->new( to: my $msg = MINE::List->new( and try again. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: converting a list into array

2002-09-04 Thread david
try: open(FOO,'foo.txt') || die $!; chomp(my @data = ); close(FOO); print "'",join("','",@data),"'"; which avoid the map function all together david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Hash of Hashes woes...

2002-09-04 Thread david
ub( \@out ); > } > } > } > > > > sub SomeSub { > my ($refdata) = @_; > my ($cty, $dom, $eng) = @{$refdata}; > . > (modify some data) > . > $Results{ $cty }{ $dom }{ $eng } = $newdata; > } if $newdata contains anything other than 3, it should got set to the new value. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Development / Production configuration switching

2002-09-04 Thread david
nd then you can just use this module in all of your scripts: #!/usr/bin/perl -w use strict; use GlobalConfig; print "$DEV_SERVER\n"; print "$PROD_SERVER\n"; __END__ the GlobalConfig module is small and it will be loaded only once even if you have multiple "client"

Re: Hash of Hashes woes...

2002-09-04 Thread david
#-- your usual stuff } this way, Perl will limit one thread to enter SomeSub at a time. try this and see what happen. Threading, of course, is experimental(still?) :-) david > > Thanks, > > Greg > >> david >> >> -- >> To unsubscribe, e-mail: [

Re: Newbie

2002-09-04 Thread david
int the total with a $ sign print "\$$total\n"; __END__ i notice that you have the line "0014595h" in your file. this will cause Perl(with the -w thingy) to issue a warning when we are executing the "$total += $_" line. the above simply ignore that and turns "0014

Re: converting a list into array

2002-09-04 Thread david
uess my newsreader is trying to be smart and parse to be something else. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: script debug help

2002-09-04 Thread david
time{$current} .= $line[5] . " "; >> $starttime{$current} .= $line[6]; > > $starttime{$current} = join ' ', @line[2 .. 6]; or you could remove the need for join all together: $starttime{$current} = "@line[2..6]"; david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: script debug help

2002-09-04 Thread david
r reg.(like SNBJH_3403,SNBJH_3211J) to the above next unless(..) line to capture more lines as you intend. of course, you will want to add the fancy format you have in your original script. david Mike Singleton wrote: > This script will ultimately return the values of the regex strings fo

Re: getting an intersection between two arrays....

2002-09-05 Thread david
print "$i\n"; #-- prints 1,2,7,8,9,10 } you will likely to lose the order of the original @hrefs as well. Or you could manually loop throught the arrays and remove them manually david Anthony E. wrote: > ie - i have two arrays (lists): > > @hrefs: a list of urls.. > and @b

Re: Detecting module existence

2002-09-05 Thread david
gt;install("Tk")\''); #-- try again... eval { require Tk; }; if($@){ print "still??? installation failed...\n"; }else{ print "fine. Tk installed correctly\n"; } }else{ print "Tk al

Re: format list

2002-09-05 Thread david
ee, this is very mess too but if you have a large list, this should help in some degree :-) david Mandar Rahurkar wrote: > Hi, > I wrote perl script so as to have a formatted list however it doesnt > work.It cant take a list as its value.It has to be $v

Re: my, hashref, and 2 arrays

2002-09-06 Thread david
vals; > } > try: my $p = af(); foreach my $key (keys %{$p}){ print "$key: $p->{$key}\n"; } sub af{ my @k = (1,2,3); my @p = ('a','b','c'); return { map { $k[$_] => $p[$_] } 0..$#k }; } david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: stuck on finding variables

2002-09-06 Thread david
h my $var (keys %vars){ print "$var\n"; } __END__ the above is far from perfect. condiser: print '$hi'; print 'abcd $hi abcd'; print <<'hi' $a $b $c hi print qw{$hi $hello}; ...etc etc these aren't variables but the above code will consid

Re: Quit with keystroke?

2002-09-06 Thread david
S pay more attention to signal. for example: #!/usr/bin/perl -w use strict; #-- press control-c to get here $SIG{INT} = sub { print "what? "; my $c = ; exit if($c =~ /^q/i); print "ignored. continue..\n";

Re: print only what a regex actually hits

2002-09-06 Thread david
xpensive and you usually can do the above without using them which should make your program run faster. david Harry Putnam wrote: > Hope this isn't too often repeated question with glaringly obvious > answer: > How to print only what a regex hits from a file, not the whole lin

Re: perlcc boot_File__Glob error (solution)

2002-09-09 Thread david
he addition of 'use File::Glob' is good enought a hint for perlcc. for more of this: perldoc perlop and then check out the I/O operators section david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: GD library

2002-09-09 Thread david
ow to install GD. you will need a few more modules before intalling GD. the README file has all that in there. or you can try your luck with: perl -MCPAN -e 'install GD' which should resolve all dependency for you and install GD automatically. david -- To unsubscribe, e-mail: [

Re: Processing Tagged Files (Real Newbie)

2002-09-09 Thread david
imply change the code to read each ... pair instead of blindly assume the next 7 lines will have everything. for example: if(//){ while(){ /<\/td>/ ? last : push(@td,$_); } } or something similar. but even if you code that in your script. it still fails if you have something like: for those, you will want a html parser. go to CPAN and you can find some. hope this get you started. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: printing output to a file

2002-09-09 Thread david
;your usual stuff\n'; but there is little reason for that because you can simply move your open() statement outside of your foreach loop. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: another beginner question

2002-09-09 Thread david
ways to do what you need. you might want to goto cpan and search for a module(i can never remember it's name!) that suits your need. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: GD library

2002-09-09 Thread david
Ebaad Ahmed wrote: > Hi David, > > I ran the command for GD install and it seemed working and it asked me for > certain packages that need to be installed and after every thing was said > and done it started installing and gave me the following errorm if it is > familiar or ha

Re: GD library

2002-09-09 Thread david
Ebaad Ahmed wrote: > Hi David, > > I got this error when ran the patch_gd.pl, looks like its looking for a > patch file. > > # perl patch_gd.pl > patch: Invalid options. > patch: Usage: patch [-blNR] [-c|-e|-n] [-d dir] [-D define] [-i > patchfile]\ >

Re: tutorial Exercises online

2002-09-09 Thread david
to learn and try, you can try them before you look at the answer. after you came up with an answer, you can then compare it with the "official" answer from the faq to look at the faq: perldoc perlfaq4 perldoc perlfaq5 ...etc david -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: issue with chomp - chop need to trim()

2002-09-09 Thread david
l lower case is not recommanded because Perl names all of it's functions using lower case. what happen if later version of Perl happen to have a function call 'outfile'? what will the following do then: print outfile "hi"; prints hi to file handle outfile? or prints

Re: issue with chomp - chop need to trim()

2002-09-09 Thread david
John W. Krahn wrote: >> $line =~ /^\s+//; > >> $line =~ s/^\s+//; even after looking at your reply for 20 seconds, i still didn't see the differences... :-) how stupid i am? thanks for spot that. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

Re: issue with chomp - chop need to trim()

2002-09-10 Thread david
Janek Schleicher wrote: > That's why the first one is only a matching, > while the second one is a substitution, > really removing something. > the first one is actually a syntax error. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: s/// in a list <-- How to do it ?

2002-09-10 Thread david
eplace occurances of > > data/ > > with nothing ( "" ) > > thanks see if this is faster if your data always have 'data/' in front: substr($_,0,5) = '' for(@k); david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: new output error

2002-09-12 Thread david
: #-- split print if(EXP) which could be doing a lot of uneccessary split. remember that split is kind of expensive and you will wasting a lot of time donig things that you might never need. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Help regarding the perl safe module

2002-09-12 Thread david
is simply a function call so Perl calls your function 'test_func' and prints the message. it's like you have: &test_func; $compartment->reval(); which of course prints your statement and make you believe that the Safe module doesn't work. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: printing hash of a hash

2002-09-12 Thread david
foreach my $ar (@{$v}){ print "$ar\n"; } } } __END__ prints: key1 data: 1 2 3 4 5 key2 data: 6 7 8 9 david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: regular expression help....

2002-09-12 Thread david
David --- Senior Programmer Analyst --- Wgo Wagner wrote: > Your log shows a space between the time and hyphen and hyphen and > Micro. You dont' have that in the regex and even more so, there is no > hyphen before Adapter log. > > You might want: > /^(\d\d-\d\d-\d{4})\

Re: go to next file

2002-09-12 Thread david
regex/o) since $regex don't change after your program start running, this will save you sometime to recompile the whole reg when it's encountered. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Can my code be shortened?

2002-09-12 Thread david
try something like: my @k = ('Sybase Server','Function','Type','Unix Machine','Location'); print ''; map { print '',$_,"\n"} @k; print ''; david Loan Tran wrote: > #!/usr/bin/perl -w > @co

Re: go to next file

2002-09-12 Thread david
will be entering a valid reg to use. i am suggest that you should not trust the user on that. there is a good chance that your user will not supply a valid reg. in that case, your program will crash. you should trap that with the eval{} or with quote your reg before passing it to Perl davi

<    1   2   3   4   5   6   7   8   9   10   >