accessing -lable value in cascade widget

2002-04-29 Thread richard noel fell
Below is some sample code which I hope will illustrate the problem I am facing. #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w use Tk; use Tk::Dialog; use strict; ## my $mw = MainWindow->new; use subs qw/file_menuitem/; $mw->configure(-menu=>my $menu

Re: assigning array to hash

2002-04-26 Thread richard noel fell
Drieux - Thanks. I altered the LABEL_FILE data format as you suggested and all works just fine now. Dick Drieux wrote: > > On Friday, April 26, 2002, at 06:55 , Jeff 'japhy' Pinyan wrote: > > > The hash is not empty -- printing "%foo" does nothing special. To dump a > > hash, do someth

Re: assigning array to hash

2002-04-26 Thread richard noel fell
Drieu : Whoops. I forgot the chomp. The data in the LABEL_FILE is formatted as: "key"=>"val", "key1"=>"val1", which seems to work since the for loop prints as expected. Dick Drieux wrote: > > On Friday, April 26, 2002, at 06:55 , Jeff 'japhy' Pinyan wrote: > > > The hash is not empty -- prin

Re: assigning array to hash

2002-04-26 Thread richard noel fell
Jeff - Thanks for your reply. Now, on to solve the remaining problems. Dick Fell Jeff 'Japhy' Pinyan wrote: > > On Apr 26, richard noel fell said: > > >Below is part of some code that reads from a file to an array and then > >attempts to assign

assigning array to hash

2002-04-26 Thread richard noel fell
Below is part of some code that reads from a file to an array and then attempts to assign the array to a hash. I get no compiling errors, but %label_hash is empty. No doubt I am being stupid. Has anyone a suggestion how to fill the hash variable? Thanks, Dick Fell open LABEL_FILE, "$cur

Re: variable not set as expected

2002-04-23 Thread richard noel fell
Nikola - An interesting point. Perhaps you are onto something, but an eval where you suggested does not work. However, you comments lead me to other ideas to try. Thanks, Dick Nikola Janceski wrote: > > I can't make sense of the code. Sorry, but this is what I see looking back.. > > [

Re: variable not set as expected

2002-04-23 Thread richard noel fell
$test_path\n";}]} @test_files]; } } } Nikola Janceski wrote: > > how are using this subroutine in your code? > > Can you give us the line where you use this sub, Tk is bit picky at times > when you try funky things. > > > -Origina

Re: variable not set as expected

2002-04-23 Thread richard noel fell
return > only the file names, not the full paths, so "grep {-f "$tests_directory/$_"} > readdir TESTS_DIR;" might not be returning anything. But then again I'm not > a huge grep user, so I could be wrong. > > -Original Message- > From: richard n

variable not set as expected

2002-04-23 Thread richard noel fell
Below is a subroutine that is part of a perl/Tk script. The variable $test_path is initialized earlier to the empty string and the variable $tests_directory is likewise initialized to the correct directory. The array @test_files contains entries such as (test1, test2, ..) and is correctly set by

Re: how to return an array reference from a subroutine

2002-04-18 Thread richard noel fell
Felix - Thanks for the very clear explanation. Dick Felix Geerinckx wrote: > > on Thu, 18 Apr 2002 12:56:43 GMT, [EMAIL PROTECTED] (Richard Noel Fell) > wrote: > > > However, I do not understand your > > comments about the return value of map. Does not map r

Re: how to return an array reference from a subroutine

2002-04-18 Thread richard noel fell
gt; On Wednesday, April 17, 2002, at 02:09 , richard noel fell wrote: > [..] > > sub create_menu_bar > > { > > my $mb = $MW->Menu(); > > $MW->configure(-menu=>$mb); > > opendir DIR, "./" or die " cannot open current directory: $!"

how to return an array reference from a subroutine

2002-04-17 Thread richard noel fell
What I am attempting to do is write a perl script that reads the sub-directories of the current directory, creates a menu bar with the sub-directories as the titles of cascade widgets and then goes into the sub-directories, read the files there and creates command widgets with the file names as t

how to make local variable retain value

2002-04-16 Thread richard noel fell
If in a subroutine, I have a statements sub { my $local_var=1 $local_var=$local_var+1; } then the next time I run this subroutine, $local_var is reinitialized to 1. However, I would like to have it retain its value from the previous call to the subroutine. For example, if $local_var

Re: problem with directory listing

2002-04-11 Thread richard noel fell
John - Thank you for your explanation. A stupid mistake on my part. Dick Fell John Edwards wrote: > > Sorry. That should have been prepend. > > -Original Message- > From: John Edwards [mailto:[EMAIL PROTECTED]] > Sent: 11 April 2002 12:47 > To: '

problem with directory listing

2002-04-11 Thread richard noel fell
Below is sample code that does not work as I intend, the intention being to list all the sub-directories in a given directory. #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w use strict; my $mw; my $menubar; my $algebra; my @file_array; my $dir_to_process = "/home/rfell/mathprogram"; opendir DH, $

Re: why can't I write to a file

2002-03-29 Thread richard noel fell
Jenda - Thank you for you very clear explanation. Dick Fell Jenda Krynicky wrote: > > From: richard noel fell <[EMAIL PROTECTED]> > > > Here is an abridged version of what I am trying to do which is: > > 1) write to a file in one subroutin

why can't I write to a file

2002-03-29 Thread richard noel fell
Here is an abridged version of what I am trying to do which is: 1) write to a file in one subroutine 2) write the contents of the original file to another file in a separate subroutine. However, I get the error message: Use of uninitialized value in string at ./scratch2.pl line 24, line 1. Us

Question about writing to file

2002-03-28 Thread richard noel fell
Here is a subroutine that prints strings to a file. I want the routine to write strings to the file in the format Question1:factor(x^2+4*x+3)=(x+3)*(x+1). However, what is written to file is Question1:factor(x^2+4*x+3) =(x+3)*(x+1), that is, a newline before the = sign. Is there some way of inhib

help with perl/Tk

2002-03-07 Thread richard noel fell
Below is a simple script which I am using as part of my attempt to learn how to program a gui with perl and Tk. I have copied the program from a book, "Cross Platform Perl" (not very good, but some isolated good parts), but get the following error message when I try to compile the program. Has any

reading one character at a time

2002-03-04 Thread richard noel fell
Is there a perl function that reads one character at a time from a string and and returns that character? Something like the following: $Line = some string; foreach ($Line){ $char=read_char($_);} Thanks, Dick Fell -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

pattern matching question

2002-02-28 Thread richard noel fell
I have the following bit of code: #!/usr/bin/perl -w open In2,"/home/rfell/tutoring/beaven/webproject/tmp/maxima_log" or die "Cannot open maxima_log:$!"; my $Line; while (defined($Line=)){ if($Line=~/(\(D\d+\))\s*(\w*)/){ print "==> $2\n"; }; }; #close In2; maxima_log is the following GCL (

perk-tk.rpm

2002-01-22 Thread richard noel fell
I have been unable to find a source for the tk module. My google searches have been fruitless. Does anyone have a pointer to a tk.rpm for redhat linux 7.1? Thanks, Dick Fell -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]