Hi Shekar,
On Fri, 24 Aug 2012 12:23:21 +0530
Shekar <[email protected]> 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
> <[email protected]>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 <[email protected]>
> > To: Perl Beginners <[email protected]>
> > 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: [email protected]
> > For additional commands, e-mail: [email protected]
> > 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: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/