Here a script that illustrates my current workaround:
#! /usr/bin/env perl
use strict;
use warnings;
my $outfile = "file_with_tables.txt";
open(OUT,">$outfile") or die "Couldn't open $outfile for writing: $!\n";
print OUT "Table 1:\n";
_print_format1(1,15,"foo");
_print_format1(2,8,"bar");
clos
On 7/5/06, Jeff Peng wrote:
Hello,
I think there are not relation between your implement and the filehandle.
As far as I can tell, a format must have the same name as the
filehandle to which you want to print it, and once you define a format
you cannot change it. So these 2 facts mean you can'
The reason I am asking is that I want to print 2 different tables to
the same text file and I don't want to use printf statements. For me
at least, code that uses printf to print something as complex as a
text table is hard to both write and read, hard to understand and hard
to debug. It's also
Hi,
Can anyone tell me if it is possible to define 2 different formats for
the same filehandle?
The reason I am asking is that I want to print 2 different tables to
the same text file and I don't want to use printf statements. For me
at least, code that uses printf to print something as complex a
Thanx Tom,
for clarification.
~Alok.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Tom Phoenix
Sent: Tuesday, July 04, 2006 10:34 PM
To: Nath, Alok (STSD)
Cc: beginners@perl.org
Subject: Re: Want to start remote desktop thru the CGI script
On
Thanx bs
for clarification.
~alok
-Original Message-
From: Bjørge Solli [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 04, 2006 10:27 PM
To: beginners@perl.org
Subject: Re: Want to start remote desktop thru the CGI script
Please reply below the text you are answering, it makes the who
Jorge Almeida wrote:
> I want to use CTRL-C to abort execution of a routine (but not of the
> main program). Something like this:
>
> # main program
> $SIG{'INT'}='IGNORE';
> (...)
> &myroutine()
> (...)
> sub myroutine{
> # do something
> (...)
> $S
[EMAIL PROTECTED] wrote:
> It was chop and not chomp that I need, I'm removing the last "/" on a
> directory path, not newlines
>
Then it might be safer to do a substitute, chop is very aggressive.
( my $x = $_[0] ) =~ s(/$)();
--
__END__
Just my 0.0002 million dollars worth,
--- S
[EMAIL PROTECTED] schreef:
> Anyways, this how my subroutine now looks:
>
> sub xyz {
> $x = $_[0];
Make that
my $x = $_[0] ;
Alternatives:
my $x = shift ;
my ($x) = @_ ;
(that last one if you only expect 1 parameter)
Put
use strict ;
use warnings ;
on top of ev
Jorge Almeida wrote:
> I want to use CTRL-C to abort execution of a routine (but not of the
> main program). Something like this:
>
> # main program
> $SIG{'INT'}='IGNORE';
> (...)
> &myroutine()
> (...)
> sub myroutine{
> # do something
> (...)
> $S
Thanks everyone for your help, I found the problem was with (1) my
understanding of how Perl functions act on variables in general and (2) with
how chop in
particular behaved.
My subroutine originally contained this:
sub xyz {
$x = chop $_[0];
... do stuff with $x
}
which demonstrates
I want to use CTRL-C to abort execution of a routine (but not of the
main program). Something like this:
# main program
$SIG{'INT'}='IGNORE';
(...)
&myroutine()
(...)
sub myroutine{
# do something
(...)
Jeff Peng wrote:
> Because the latter (grep) is essentially a loop,so grep() is not better
> than using 'while(<>)'.Specially,when the file's size is large,reading
> all the contents of this file into an array would consume your memory
> quickly.
>
Another way to speed things up is to pre-filter t
Because the latter (grep) is essentially a loop,so grep() is not better than
using 'while(<>)'.Specially,when the file's size is large,reading all the
contents of this file into an array would consume your memory quickly.
If your /search_pattern/ is changing frequently,I would give another exampl
[EMAIL PROTECTED] am Dienstag, 4. Juli 2006 19:17:
> I have a subroutine that, amongst other things, chops a scalar variable,
> $dir, passed to it as an argument. The problem is that I need $dir intact
> (ie unchopped) after calling said subroutine, but it has been altered by
> the chop. I can't
Aaron Priven wrote:
> You should show us some code.
>
> Normally you would do this in the subroutine:
>
> sub routine {
>
>my $mydir = shift;
># which puts the value of $_[0] into $mydir
># and then removes that from the argument list
>chop $mydir;
># do stuff with $mydir
>
On Jul 4, 2006, at 10:46 AM, Aaron Priven wrote:
you could pass it an expression that returns the value of $a.
Sorry, I should have said "your variable" instead of "$a" here.
--
Aaron Priven, [EMAIL PROTECTED], http://www.priven.com/aaron
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For a
You should show us some code.
Normally you would do this in the subroutine:
sub routine {
my $mydir = shift;
# which puts the value of $_[0] into $mydir
# and then removes that from the argument list
chop $mydir;
# do stuff with $mydir
}
That makes a copy of the value. It sound
[EMAIL PROTECTED] wrote:
> I have a subroutine that, amongst other things, chops a scalar variable,
> $dir, passed to it as an argument. The problem is that I need $dir intact
> (ie
> unchopped) after calling said subroutine, but it has been altered by the
> chop. I
> can't figure out how to
Hi all,
I'm searching for a word in a file. I wrote the code like this.
while ( ) {
if ( /search_pattern/ ) {
executebale.
}
}
or
Can I use like,
@list = ;
grep();# using grep on list
Let me know a faster way to search.
Regards,
Rajeev
I have a subroutine that, amongst other things, chops a scalar variable,
$dir, passed to it as an argument. The problem is that I need $dir intact (ie
unchopped) after calling said subroutine, but it has been altered by the chop.
I
can't figure out how to pass the value (or more precisely, a
On 7/4/06, Nath, Alok (STSD) <[EMAIL PROTECTED]> wrote:
What I want to provide is a page with some machine Id's.
So once somebody clicks the hyperlinks , it should remote
desktop instead of telnet.
If the machine understands the telnet: protocol, you can use clickable
telnet: U
Please reply below the text you are answering, it makes the whole thing easier
to follow.
On Tuesday 04 July 2006 18:38, Nath, Alok (STSD) wrote:
> What I want to provide is a page with some machine Id's.
> So once somebody clicks the hyperlinks , it should remote
> desktop instead of
Tom,
Sorry if I am not able to explain it.
What I want to provide is a page with some machine Id's.
So once somebody clicks the hyperlinks , it should remote
desktop instead of telnet.
Is it not possible ?
The current script is triggering a telnet session.
On 7/4/06, Nath, Alok (STSD) <[EMAIL PROTECTED]> wrote:
What I want is when I click the hyperlink it
should run the command
'mstsc IP Address'(instead of telnet) so that I can remote
desktop to that machine.
So, you want to run a program on the computer at the browser's end of
the conn
Hi,
Here's a script which has some two cells in the table.I want to
make
a change here. What I want is when I click the hyperlink it
should run the command
'mstsc IP Address'(instead of telnet) so that I can remote
desktop to that machine.
Can anybody help me how
26 matches
Mail list logo