Re: insert in perl tk
i have to call localtime () function to get the latest time everytime when i print the lines using insert method i mean , i need to print the latest time in scrolled text box lets say : use Tk; $mw = MainWindow-new(); my $t = $mw-Scrolled(Text)-pack (-side = 'left', -expand=1); $t-insert(end, $c = \gettime); sub gettime { $c = localtime(); return $c; } so whenever i call insert method , it shud call function gettime and print the latest time in the text box please suggest regards irfan From: Jim Gibson jimsgib...@gmail.com To: Perl Beginners beginners@perl.org Sent: Friday, August 24, 2012 11:13 AM Subject: Re: insert in perl tk On Aug 23, 2012, at 9:35 PM, Irfan Sayed wrote: thanks. this will help to print the contents of array on separate line. however, if at all we need to call function then what is the syntax, how we can call that ? What function do you want to call? When do you want to call it? What does the function have to do with the array you want to print? What does it have to do with Tk? please suggest . Please let us know in more detail what you are trying to do. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: insert in perl tk
Try this. $t-insert(end, gettime); -- Shekar On Fri, Aug 24, 2012 at 11:58 AM, Irfan Sayed irfan_sayed2...@yahoo.comwrote: i have to call localtime () function to get the latest time everytime when i print the lines using insert method i mean , i need to print the latest time in scrolled text box lets say : use Tk; $mw = MainWindow-new(); my $t = $mw-Scrolled(Text)-pack (-side = 'left', -expand=1); $t-insert(end, $c = \gettime); sub gettime { $c = localtime(); return $c; } so whenever i call insert method , it shud call function gettime and print the latest time in the text box please suggest regards irfan From: Jim Gibson jimsgib...@gmail.com To: Perl Beginners beginners@perl.org Sent: Friday, August 24, 2012 11:13 AM Subject: Re: insert in perl tk On Aug 23, 2012, at 9:35 PM, Irfan Sayed wrote: thanks. this will help to print the contents of array on separate line. however, if at all we need to call function then what is the syntax, how we can call that ? What function do you want to call? When do you want to call it? What does the function have to do with the array you want to print? What does it have to do with Tk? please suggest . Please let us know in more detail what you are trying to do. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: insert in perl tk
thanks. it worked! regards irfan From: Shekar c.shekar1...@gmail.com To: Irfan Sayed irfan_sayed2...@yahoo.com Cc: Jim Gibson jimsgib...@gmail.com; Perl Beginners beginners@perl.org Sent: Friday, August 24, 2012 12:23 PM Subject: Re: insert in perl tk Try this. $t-insert(end, gettime); -- Shekar On Fri, Aug 24, 2012 at 11:58 AM, Irfan Sayed irfan_sayed2...@yahoo.com wrote: i have to call localtime () function to get the latest time everytime when i print the lines using insert method i mean , i need to print the latest time in scrolled text box lets say : use Tk; $mw = MainWindow-new(); my $t = $mw-Scrolled(Text)-pack (-side = 'left', -expand=1); $t-insert(end, $c = \gettime); sub gettime { $c = localtime(); return $c; } so whenever i call insert method , it shud call function gettime and print the latest time in the text box please suggest regards irfan From: Jim Gibson jimsgib...@gmail.com To: Perl Beginners beginners@perl.org Sent: Friday, August 24, 2012 11:13 AM Subject: Re: insert in perl tk On Aug 23, 2012, at 9:35 PM, Irfan Sayed wrote: thanks. this will help to print the contents of array on separate line. however, if at all we need to call function then what is the syntax, how we can call that ? What function do you want to call? When do you want to call it? What does the function have to do with the array you want to print? What does it have to do with Tk? please suggest . Please let us know in more detail what you are trying to do. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: insert in perl tk
Hi Shekar, On Fri, 24 Aug 2012 12:23:21 +0530 Shekar c.shekar1...@gmail.com wrote: Try this. $t-insert(end, gettime); Please don't recommend people to use leading ampersands in subroutine calls: * http://perl-begin.org/tutorials/bad-elements/#ampersand-in-subroutine-calls * https://www.socialtext.net/perl5/subroutines_called_with_the_ampersand Instead write: $t-insert(end, gettime()); Regards, Shlomi Fish -- Shekar On Fri, Aug 24, 2012 at 11:58 AM, Irfan Sayed irfan_sayed2...@yahoo.comwrote: i have to call localtime () function to get the latest time everytime when i print the lines using insert method i mean , i need to print the latest time in scrolled text box lets say : use Tk; $mw = MainWindow-new(); my $t = $mw-Scrolled(Text)-pack (-side = 'left', -expand=1); $t-insert(end, $c = \gettime); sub gettime { $c = localtime(); return $c; } so whenever i call insert method , it shud call function gettime and print the latest time in the text box please suggest regards irfan From: Jim Gibson jimsgib...@gmail.com To: Perl Beginners beginners@perl.org Sent: Friday, August 24, 2012 11:13 AM Subject: Re: insert in perl tk On Aug 23, 2012, at 9:35 PM, Irfan Sayed wrote: thanks. this will help to print the contents of array on separate line. however, if at all we need to call function then what is the syntax, how we can call that ? What function do you want to call? When do you want to call it? What does the function have to do with the array you want to print? What does it have to do with Tk? please suggest . Please let us know in more detail what you are trying to do. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- - Shlomi Fish http://www.shlomifish.org/ Rethinking CPAN - http://shlom.in/rethinking-cpan Bill Gates, CEO of Microsoft decides to use Richard Stallman’s Emacs as the basis of his company’s state‐of‐the‐art product Microsoft Editing Macros™ Enterprise Edition XP .NET Professional. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: insert in perl tk
Thanks for the correction Shlomi. Mistake from my side, i copy pasted the wrong line from my terminal !!! -- Shekar On Fri, Aug 24, 2012 at 2:49 PM, Shlomi Fish shlo...@shlomifish.org wrote: Hi Shekar, On Fri, 24 Aug 2012 12:23:21 +0530 Shekar c.shekar1...@gmail.com wrote: Try this. $t-insert(end, gettime); Please don't recommend people to use leading ampersands in subroutine calls: * http://perl-begin.org/tutorials/bad-elements/#ampersand-in-subroutine-calls * https://www.socialtext.net/perl5/subroutines_called_with_the_ampersand Instead write: $t-insert(end, gettime()); Regards, Shlomi Fish -- Shekar On Fri, Aug 24, 2012 at 11:58 AM, Irfan Sayed irfan_sayed2...@yahoo.comwrote: i have to call localtime () function to get the latest time everytime when i print the lines using insert method i mean , i need to print the latest time in scrolled text box lets say : use Tk; $mw = MainWindow-new(); my $t = $mw-Scrolled(Text)-pack (-side = 'left', -expand=1); $t-insert(end, $c = \gettime); sub gettime { $c = localtime(); return $c; } so whenever i call insert method , it shud call function gettime and print the latest time in the text box please suggest regards irfan From: Jim Gibson jimsgib...@gmail.com To: Perl Beginners beginners@perl.org Sent: Friday, August 24, 2012 11:13 AM Subject: Re: insert in perl tk On Aug 23, 2012, at 9:35 PM, Irfan Sayed wrote: thanks. this will help to print the contents of array on separate line. however, if at all we need to call function then what is the syntax, how we can call that ? What function do you want to call? When do you want to call it? What does the function have to do with the array you want to print? What does it have to do with Tk? please suggest . Please let us know in more detail what you are trying to do. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- - Shlomi Fish http://www.shlomifish.org/ Rethinking CPAN - http://shlom.in/rethinking-cpan Bill Gates, CEO of Microsoft decides to use Richard Stallman’s Emacs as the basis of his company’s state‐of‐the‐art product Microsoft Editing Macros™ Enterprise Edition XP .NET Professional. Please reply to list if it's a mailing list post - http://shlom.in/reply .
Re: insert in perl tk
can someone please suggest ? regards irfan From: Irfan Sayed irfan_sayed2...@yahoo.com To: beginners@perl.org beginners@perl.org Sent: Thursday, August 23, 2012 4:15 PM Subject: insert in perl tk hi, can we call function in the insert method of perl tk ? i have code like this: $t-insert(end, \abc); so when this line gets executed, it should first call function abc please suggest regards irfan
Re: insert in perl tk
On Thursday, August 23, 2012 at 10:15 AM, Irfan Sayed wrote: can someone please suggest ? Explain what you're actually trying to achieve, instead of asking how to do what you think will let you accomplish what you're trying to achieve. Yes, if you write the insert() method properly, you could certainly pass it those two arguments and have it call the second one (you don't need to quote the function reference, however). BUT I can't think of a good reason why you'd want to do that, so you need to explain what you're actually trying to do, because what you're asking about looks really silly. Also, 6.5 hours is not a terribly long time to wait for an answer on this list. Please be more patient in the future before sending additional traffic. j.
Re: insert in perl tk
it was quite rude. anyway lets say if i have to display the contents of array using insert method. if i just type : $t-insert(end, @arr1); then surely , it will print the contents of array but on the same line i need to print the contents of array on separate line , so , i thought , i should write one function where i will print the contents of array on each line and call that function from insert method please suggest regards irfan From: John SJ Anderson geneh...@genehack.org To: beginners@perl.org beginners@perl.org Sent: Thursday, August 23, 2012 10:54 PM Subject: Re: insert in perl tk On Thursday, August 23, 2012 at 10:15 AM, Irfan Sayed wrote: can someone please suggest ? Explain what you're actually trying to achieve, instead of asking how to do what you think will let you accomplish what you're trying to achieve. Yes, if you write the insert() method properly, you could certainly pass it those two arguments and have it call the second one (you don't need to quote the function reference, however). BUT I can't think of a good reason why you'd want to do that, so you need to explain what you're actually trying to do, because what you're asking about looks really silly. Also, 6.5 hours is not a terribly long time to wait for an answer on this list. Please be more patient in the future before sending additional traffic. j.
Re: insert in perl tk
On Aug 23, 2012, at 10:51 AM, Irfan Sayed wrote: it was quite rude. anyway What was quite rude? lets say if i have to display the contents of array using insert method. if i just type : $t-insert(end, @arr1); then surely , it will print the contents of array but on the same line I don't use Perl/Tk, but I am assuming $t is some sort of Tk widget, and you are attempting to add a string to the end of it. Maybe you can post a short, complete program that demonstrates what you are trying to do. i need to print the contents of array on separate line , so , i thought , i should write one function where i will print the contents of array on each line and call that function from insert method please suggest I would recommend putting whatever you want to insert into a scalar variable and inserting that by making it the second argument of your insert statement. For example, if you want to insert the elements of an array, one element per line, do this: my $text = join(\n,@arr1); $t-insert('end', $text); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: insert in perl tk
On Thu, 23 Aug 2012 10:51:09 -0700 (PDT) Irfan Sayed irfan_sayed2...@yahoo.com wrote: i need to print the contents of array on separate line , so , i thought , i should write one function where i will print the contents of array on each line Do you mean you want each item from an array on each line? If so: $t-insert(end, join( \n, @array )); See `perldoc -f join` for details. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. _Perl links_ official site : http://www.perl.org/ beginners' help : http://learn.perl.org/faq/beginners.html advance help: http://perlmonks.org/ documentation : http://perldoc.perl.org/ news: http://perlsphere.net/ repository : http://www.cpan.org/ blog: http://blogs.perl.org/ regional groups : http://www.pm.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: insert in perl tk
thanks. this will help to print the contents of array on separate line. however, if at all we need to call function then what is the syntax, how we can call that ? please suggest . regards irfan From: Shawn H Corey shawnhco...@gmail.com To: beginners@perl.org Cc: Irfan Sayed irfan_sayed2...@yahoo.com Sent: Thursday, August 23, 2012 11:40 PM Subject: Re: insert in perl tk On Thu, 23 Aug 2012 10:51:09 -0700 (PDT) Irfan Sayed irfan_sayed2...@yahoo.com wrote: i need to print the contents of array on separate line , so , i thought , i should write one function where i will print the contents of array on each line Do you mean you want each item from an array on each line? If so: $t-insert(end, join( \n, @array )); See `perldoc -f join` for details. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. _Perl links_ official site : http://www.perl.org/ beginners' help : http://learn.perl.org/faq/beginners.html advance help : http://perlmonks.org/ documentation : http://perldoc.perl.org/ news : http://perlsphere.net/ repository : http://www.cpan.org/ blog : http://blogs.perl.org/ regional groups : http://www.pm.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: insert in perl tk
On Aug 23, 2012, at 9:35 PM, Irfan Sayed wrote: thanks. this will help to print the contents of array on separate line. however, if at all we need to call function then what is the syntax, how we can call that ? What function do you want to call? When do you want to call it? What does the function have to do with the array you want to print? What does it have to do with Tk? please suggest . Please let us know in more detail what you are trying to do. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/