Hi,
I have a perl regex to test if a file resides under a particular
directory. The test looks like this:
if ($filename =~ $directory) {
# yes, this filename resides under directory
}
This is working for most cases. However, it fails is the directory
contains a +. For example:
$filename
Dan Langille wrote:
Hi,
Hello,
I have a perl regex to test if a file resides under a particular
directory. The test looks like this:
if ($filename =~ $directory) {
# yes, this filename resides under directory
}
This is working for most cases. However, it fails is the directory
I wan to write a sub return true or false if the var was initialized.
Can someone correct this sub or is it good?
...
if(isNULL($x) { print it is null\n);
else { print it is NOT null\n);
...
sub isNULL
{
return $_[0] =~ //
}
thanks,
-rkl
--
To unsubscribe, e-mail: [EMAIL
On Thursday, October 2, 2003, at 04:25 PM, [EMAIL PROTECTED] wrote:
I wan to write a sub return true or false if the var was initialized.
We can do that, but I really don't think we need a sub for it, since
there is a built-in.
Can someone correct this sub or is it good?
No, I wouldn't call it
if ( ! defined $x )
I read up on defined and undefined. But I'm looking for a test that will
this return true or false to a var condition:
...
sub isNULL
{
return undefined $_[0] $_[0] eq '' $_[0] eq ;
}
# my goal is all three return the same as
# my proposed sub isNULL()
my $x; #
On Thursday, October 2, 2003, at 05:09 PM, [EMAIL PROTECTED] wrote:
if ( ! defined $x )
I read up on defined and undefined. But I'm looking for a test that
will
this return true or false to a var condition:
perldoc -f defined
perldoc -f undef
The second is a little different than what you
Are you saying this would do everything that I want?
#I'm considering undefined var and '' and 0s are the same thing.
if($x) ... true - do_something
-rkl
On Thursday, October 2, 2003, at 05:09 PM, [EMAIL PROTECTED] wrote:
if ( ! defined $x )
I read up on defined and undefined. But I'm
On Thursday, October 2, 2003, at 06:29 PM, [EMAIL PROTECTED] wrote:
Are you saying this would do everything that I want?
#I'm considering undefined var and '' and 0s are the same thing.
if($x) ... true - do_something
I said it would, if you don't mind 0 being false.
James
--
To unsubscribe,
you mean $x=0; would be false?
On Thursday, October 2, 2003, at 06:29 PM, [EMAIL PROTECTED] wrote:
Are you saying this would do everything that I want?
#I'm considering undefined var and '' and 0s are the same thing.
if($x) ... true - do_something
I said it would, if you don't mind 0
On Thursday, October 2, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote:
you mean $x=0; would be false?
Yep.
James
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-Original Message-
From: James Edward Gray II [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 5:20 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Testing Uninitialized Vars
On Thursday, October 2, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote:
you mean
On Thursday, October 2, 2003, at 07:23 PM, LoBue, Mark wrote:
-Original Message-
From: James Edward Gray II [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 5:20 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Testing Uninitialized Vars
On Thursday, October 2, 2003
-
From: James Edward Gray II [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 5:20 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Testing Uninitialized Vars
On Thursday, October 2, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote:
you mean $x=0; would be false?
Yep
On Oct 2, [EMAIL PROTECTED] said:
To recap, I want to test if a var is undefined or ''.
if(undefined $x length($x)==0)
There IS no 'undefined' function in Perl, and you don't want to use ,
you'd want to use ||, since the empty string IS defined.
if (not defined($x) or length($x) == 0) {
if (defined $x and length $x)
So, is this the opposite?
if (! defined $x and length $x)
or do I have to parenthesis
if (! (defined $x and length $x))
-rkl
On Oct 2, [EMAIL PROTECTED] said:
To recap, I want to test if a var is undefined or ''.
if(undefined $x length($x)==0)
There IS
On Thu, Oct 02, 2003 at 07:03:02PM -0700, [EMAIL PROTECTED] wrote:
if (defined $x and length $x)
So, is this the opposite?
if (! defined $x and length $x)
Nope; you've got a precedence problem.
unless( defined $x and length $x ) { }
--
Steve
--
To unsubscribe, e-mail: [EMAIL
unless understood, how about this.
if (defined $x and length $x)
So, is this the opposite?
if (! defined $x and ! length $x)
-rkl
On Thu, Oct 02, 2003 at 07:03:02PM -0700, [EMAIL PROTECTED] wrote:
if (defined $x and length $x)
So, is this the opposite?
if (! defined $x and length $x)
On Thu, Oct 02, 2003 at 07:41:41PM -0700, [EMAIL PROTECTED] wrote:
unless understood, how about this.
if (defined $x and length $x)
So, is this the opposite?
if (! defined $x and ! length $x)
Nope; now you've got a boolean logic problem.
Either of these would work, but unless() is
if (defined $x and length $x)
So, is this the opposite?
if (! defined $x and ! length $x)
I don't think so. It's basic Aristotelian logic and can be determined
by truth tables or testing. Questions are mere conjecture :)
The negative of a statement, A, is: not A. That can be writted
Kevin == Kevin Struckhoff [EMAIL PROTECTED] writes:
Kevin Actually, using glob works easily enough:
Kevin $file = glob $DATA_HOME/KeyLinks\*.csv;
Kevin print $file;
Kevin print \n;
Using glob() in a scalar context like that will give you gas, and make
your coding life miserable.
You want this
Using Perl 5.6.1 on HP-UX.
I need to test for the existence of a file every day. The filename
changes each day because the filename contains a data and time stamp.
For example, today's filename is KeyLinks_082903_120712.csv. So I would
like to test for KeyLinks*.csv
My code is as follows:
Kevin Struckhoff wrote:
Using Perl 5.6.1 on HP-UX.
I need to test for the existence of a file every day. The filename
changes each day because the filename contains a data and time stamp.
For example, today's filename is KeyLinks_082903_120712.csv. So I
would like to test for KeyLinks*.csv
: Friday, August 29, 2003 10:59 AM
To: Kevin Struckhoff; [EMAIL PROTECTED]
Subject: RE: Testing for the existence of a file
Sorry that this is ugly - I wrote it quickly one day...
It checks for the file, and makes sure the date stamp is within 10
minutes. (Date::Manip was overkill for this). Who
crontab to run this every 10 minutes.
-Original Message-
From: Kevin Struckhoff [mailto:[EMAIL PROTECTED]
Sent: Friday, August 29, 2003 10:24 AM
To: [EMAIL PROTECTED]
Subject: Testing for the existence of a file
Using Perl 5.6.1 on HP-UX.
I need to test for the existence of a file every
test
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.505 / Virus Database: 302 - Release Date: 7/30/2003
David Storrs [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I've got a function that takes several arguments, the first of which
should be a scalar (specifically, a string). I'd like to have a
precondition to verify that the argument is, in fact, a scalar. Is
there a way to do
David Storrs wrote:
I've got a function that takes several arguments, the first of which
should be a scalar (specifically, a string). I'd like to have a
precondition to verify that the argument is, in fact, a scalar. Is
there a way to do that (preferably without using modules--I'm trying
to
On Fri, Jul 04, 2003 at 06:02:21PM -0400, Steve Grazzini wrote:
On Fri, Jul 04, 2003 at 02:18:40PM -0700, David Storrs wrote:
I've got a function that takes several arguments, the first of
which should be a scalar (specifically, a string). I'd like to
have a precondition to verify that
On Fri, Jul 04, 2003 at 06:03:55PM -0400, Casey West wrote:
It was Friday, July 04, 2003 when David Storrs took the soap box, saying:
: I've got a function that takes several arguments, the first of which
: should be a scalar (specifically, a string). I'd like to have a
: precondition to
David Storrs [EMAIL PROTECTED] wrote:
:
: I was trying to avoid prototypes, because I wanted
: people to be able to pass the arguments in as
: function(@args), but maybe this is the way to go.
: Or maybe I just won't worry about it.
From your other posts it seems like your trying
to avoid a
On Sat, Jul 05, 2003 at 12:29:46PM -0400, Bob Showalter wrote:
David Storrs wrote:
I've got a function that takes several arguments, the first of which
should be a scalar (specifically, a string). I'd like to have a
precondition to verify that the argument is, in fact, a scalar. Is
I've got a function that takes several arguments, the first of which
should be a scalar (specifically, a string). I'd like to have a
precondition to verify that the argument is, in fact, a scalar. Is
there a way to do that (preferably without using modules--I'm trying
to write an entirely
It was Friday, July 04, 2003 when David Storrs took the soap box, saying:
: I've got a function that takes several arguments, the first of which
: should be a scalar (specifically, a string). I'd like to have a
: precondition to verify that the argument is, in fact, a scalar. Is
: there a way to
On Fri, Jul 04, 2003 at 02:18:40PM -0700, David Storrs wrote:
I've got a function that takes several arguments, the first of
which should be a scalar (specifically, a string). I'd like to
have a precondition to verify that the argument is, in fact, a
scalar.
I'll recommend that you
David Storrs wrote:
I've got a function that takes several arguments, the first of which
should be a scalar (specifically, a string). I'd like to have a
precondition to verify that the argument is, in fact, a scalar. Is
there a way to do that (preferably without using modules--I'm trying
I'm curious if it's possible to make a web page that controls:
1. testing to see if a socket is available
2. if not searching for another socket #
3. use html buttons to open and close sockets.
Does anyone have an example of this?
Wilson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 11:06 AM
Subject: image property testing... take II
ok, i have cleaned up the code, and fixed all of the mistakes that i can
find, but i still can't get this tying to compile and run. and, my code
surely isn't written
11:06 AM
Subject: image property testing... take II
ok, i have cleaned up the code, and fixed all of the
mistakes that i
can
find, but i still can't get this tying to compile and run.
and, my code
surely isn't written stout enough to handle a 'use strict'.
if someone
could
ok, i have cleaned up the code, and fixed all of the mistakes that i can
find, but i still can't get this tying to compile and run. and, my code
surely isn't written stout enough to handle a 'use strict'. if someone
could tell me what i am STILL doing wrong i'd appreciate it. The Code:
ok, i have cleaned up the code, and fixed all of the mistakes
that i can
find, but i still can't get this tying to compile and run.
and, my code
surely isn't written stout enough to handle a 'use strict'.
if someone
could tell me what i am STILL doing wrong i'd appreciate it. The
Shawn Wilson wrote:
... my code
surely isn't written stout enough to handle a 'use strict'. if someone
could tell me what i am STILL doing wrong i'd appreciate it.
Hi Shawn,
Please re-examine your operating precepts. By not using strict, you are passing up
the best help you can get. If
This is pretty much my first perl program, so please escuse me if there
are loads of errors, but i only get two reported to me which i can't
figure out, any help would be appreciated.
#!/usr/bin/perl
use File::Find;
use File::Removeqw(remove);
use Image::Info;
use File::Scan;
sub
Shawn Wilson wrote:
This is pretty much my first perl program, so please escuse me if there
are loads of errors, but i only get two reported to me which i can't
figure out, any help would be appreciated.
#!/usr/bin/perl
You should enable warnings and strict while developing your program.
Tried to send something yesterday but it didn't go through.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.408 / Virus Database: 230 - Release Date: 10/24/2002
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
Hi,
Does anyone know how to test for a hidden or system file under Windows
95/2000?
This works:
use strict;
use Win32::File;
my $attr;
my $file = 'C:\Perl\Scripts\test.txt';
Win32::File::GetAttributes($file,$attr );
if ($attr HIDDEN || $attr SYSTEM) {
print $file attributes are:
Does anyone know how to test for a hidden or system file under Windows 95/2000?
Thanks in advance for your help.
file!;
}
elsif( $fileattr SYSTEM ) {
print System file!;
}
Tanton
- Original Message -
From: Tin-Shan Chau [EMAIL PROTECTED]
To: Help on PERL [EMAIL PROTECTED]
Sent: Saturday, October 26, 2002 6:34 PM
Subject: Testing for hidden or system files
Does anyone know how to test
-Original Message-
From: Thomas 'Gakk' Summers [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 8:34 AM
To: [EMAIL PROTECTED]
Subject: File testing
Warning: Perl Novice Alert!
I'm trying to:
1. read in a list of files,
2. test for text,
3. convert the text
-Original Message-
From: Thomas 'Gakk' Summers [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 8:34 AM
To: [EMAIL PROTECTED]
Subject: File testing
Warning: Perl Novice Alert!
I'm trying to:
1. read in a list of files,
2. test for text,
3. convert the text files from '\n
. Singh [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
-Original Message-
From: Thomas 'Gakk' Summers [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 8:34 AM
To: [EMAIL PROTECTED]
Subject: File testing
Warning: Perl Novice Alert!
I'
Bob Showalter wrote:
A more idiomatic way to write this is:
for my $i (0 .. @files) {
you probably mean:
for my $i (0 .. $#files){
}
the range operator is inclusive.
david
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Thomas 'Gakk' Summers wrote:
Warning: Perl Novice Alert!
I'm trying to:
1. read in a list of files,
2. test for text,
3. convert the text files from '\n' unix to '\r\n' dos
4. write them to a temporary location.
The code below produces an error: 'Use of uninitialized value in -f
Thanks for your help.
I rewrote it using a mix of your suggestions and it works fine now.
FYI: The 'chomp' statement was eliminating the '/n' so the pattern match
was not occuring. That's fixed now too.
Tom.
Thomas 'Gakk' Summers [EMAIL PROTECTED] wrote in message
[EMAIL
On Windows2000.
I have an html page that calls a perl script in a form but IE does not
execute the script but rather asks that it be downloaded.
Perl is installed in E:\foo\Perl and not the usual C:\Perl
directory. could this have something to do with it?
Thanks,
Al
--
To unsubscribe,
]
Cc:
Subject: testing CGI without webserver on NT?
On Windows2000.
I have an html page that calls a perl script in a form but IE
does not
execute the script but rather asks that it be downloaded.
Perl
: 07 May 2002 17:38
To: [EMAIL PROTECTED]
Subject: Testing for command success
I'd like to test the following command to see if it
ran successfully? Have no idea how or which variable stores
the success of a command ($!, $], $_ )?
system tar cvf ../test.tar *.grib;
Tried:
if (system tar cvf
On Tue, 2002-05-07 at 11:37, siren jones wrote:
I'd like to test the following command to see if it
ran successfully? Have no idea how or which variable stores
the success of a command ($!, $], $_ )?
system tar cvf ../test.tar *.grib;
Tried:
if (system tar cvf ../test.tar *.grib;)
The return code is also returned by the system() function. It looks to me
like the system isn't understanding what you're sending to it. Maybe you
could try single quotes?
-Original Message-
From: Ho, Tony
To: 'siren jones'; [EMAIL PROTECTED]
Sent: 5/7/02 8:46 AM
Subject: RE: Testing
Tony and Chas, thanks for the help.
First problem was using switched from DOS PC to UNIX system which had no
idea what #! c:\perl was since it wanted #! /usr/global/perl.
Don't really understand how
$exit_value = $? 8;
$signal_num = $? 127;
$dumped_core = $?
Yeah, Tony your sturcture worked fine... except
system tar cvf ./test.tar *.grib
if ($? == 0) {
print \nSuccess!\n;
}
else {
print \nUnsuccessful!\n;
}
Perl programmers are lazy, and don't use things like '== 0' almost 100% of the time.
The
following should work
On Friday, May 3, 2002, at 06:22 , Maureen E Fischer wrote:
I am about to write my first CGI/Perl application. I have read Learning
Perl and I now am reading the Castro Perl and CGI book and the O'Reilly
CGI book. I was going to write and test my work using IIS on Windows
because it
drieux,
i've been monitoring this list and couldn't help but notice the volume of
your posts. i have to ask: do you ever sleep?
:) james
- Original Message -
From: drieux [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: May 03, 2002 08:45
Subject: Re: developing and testing first CGI/Perl
From: james [EMAIL PROTECTED]
Date: Fri, 3 May 2002 08:54:49 -0500
To: [EMAIL PROTECTED]
Subject: Re: developing and testing first CGI/Perl application
drieux,
i've been monitoring this list and couldn't help but notice the volume of
your posts. i have to ask: do you ever sleep
To: Perl
Subject: Re: developing and testing first CGI/Perl application
From: james [EMAIL PROTECTED]
Date: Fri, 3 May 2002 08:54:49 -0500
To: [EMAIL PROTECTED]
Subject: Re: developing and testing first CGI/Perl application
drieux,
i've been monitoring this list and couldn't
On Friday, May 3, 2002, at 06:54 , james wrote:
[..]
i've been monitoring this list and couldn't help but notice the volume of
your posts. i have to ask: do you ever sleep?
when I can. ( no smiley )
:) james
may I recommend:
http://www.wetware.com/drieux/screeds/LiNox.html
actually you
Basically, I have 30 records in one file and another file with 25 records...
these files are opened for reading, a record from the first file is paired
with a record from the second file and output a 3rd file. Obviously, the
first 25 records are fine, but the last five records are being paired
On Tue, 2002-04-23 at 17:00, Ron Powell wrote:
Basically, I have 30 records in one file and another file with 25 records...
these files are opened for reading, a record from the first file is paired
with a record from the second file and output a 3rd file. Obviously, the
first 25 records
open (RSTDATA, rst/r.$event..rst)|| print Oops;
$winner = RSTDATA;
if ($winner eq na)
{
print FinalistsbrDid Not Play;
}
else
{
print $winner;
}
Why does the above code always print the value of $winner, and never
FinalistsbrDid Not Play, even when the line of text in the file is
just the
, April 05, 2002 3:57 PM
To: [EMAIL PROTECTED]
Subject: Problem testing variable
open (RSTDATA, rst/r.$event..rst)|| print Oops;
$winner = RSTDATA;
if ($winner eq na)
{
print FinalistsbrDid Not Play;
}
else
{
print $winner;
}
Why does the above code always print the value of $winner
chomp($winner) before your if statements. or do if ($winner eq na\n)
Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com
- Original Message -
From: Glenn Cannon [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 05, 2002 12:56 PM
Subject: Problem testing variable
You may want to cycle through the file, line by line:
while(RSTDATA){
chomp;
if( . . .
}
}
That should do it.
-Original Message-
From: Glenn Cannon [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 3:57 PM
To: [EMAIL PROTECTED]
Subject: Problem testing
i list,
I'll swap from answering questions to asking question today. Hopefully, I wouldn't be
the only
person to learn something this way :)
Anyway, within some code (a module for CPAN actually), I want to write:
alarm $timeout
unless not implemented(alarm);
which reads rather nicely.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 6:16 PM
To: Beginners Perl Mailing List
Subject: RE: Testing for filehandles
On Wed, 27 Mar 2002, Bob Showalter wrote:
You can pass a filehandle glob to IO::Handle::opened
maybe
should be
defined(fileno(F))
Since 0 is a valid file number (STDIN).
So, technically, I should be testing for definedness instead of truth.
i.e., From `perldoc -f fileno`:
Returns the file descriptor for a filehandle, or
undefined if the filehandle is not open.
If you're
Hello, All:
I've looked around for an answer to this (The Camel Book, The Ram Book,
perldoc, google.com, etc.) but can't find a thing: Is it possible to test
for the existence of a filehandle?
I've got a small script that optionally opens a filehandle. If that
filehandle exists, I'd like to
You'd probably have better luck testing for the open() command's success
use Getopts::Std;
getopts(n);
if($opt_n){
open(OPT_LOG,/tmp/foo.txt) || die Could not open foo.txt!\n;
}
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 12
On Wed, 2002-03-27 at 15:18, [EMAIL PROTECTED] wrote:
Hello, All:
I've looked around for an answer to this (The Camel Book, The Ram Book,
perldoc, google.com, etc.) but can't find a thing: Is it possible to test
for the existence of a filehandle?
I've got a small script that optionally
Tim:
I know, I know: I excluded the or die portion for
readability/simplicity.
On Wed, 27 Mar 2002, Timothy Johnson wrote:
You'd probably have better luck testing for the open() command's success
I wrote:
use Getopts::Std;
getopts(n);
open(OPT_LOG,/tmp/foo.txt) if ($opt_n);
while
Mailing List
[EMAIL PROTECTED]
Sent: Wednesday, March 27, 2002 1:32 PM
Subject: RE: Testing for filehandles
You'd probably have better luck testing for the open() command's success
use Getopts::Std;
getopts(n);
if($opt_n){
open(OPT_LOG,/tmp/foo.txt) || die Could not open foo.txt!\n
, 2002 1:46 PM
To: Timothy Johnson; Beginners Perl Mailing List
Subject: Re: Testing for filehandles
How would that work with use strict;? I tried it once and when I declared my
$opt_n before using getopts, it wouldn't work.
Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com
On Wed, 27 Mar 2002, Agustin Rivera wrote:
How would that work with use strict;? I tried it once and when I declared my
$opt_n before using getopts, it wouldn't work.
Agustin:
From the Getopt::Std man page:
Note that, if your code is running under the recommended
`use strict
]
Sent: Wednesday, March 27, 2002 1:32 PM
Subject: RE: Testing for filehandles
You'd probably have better luck testing for the open() command's success
use Getopts::Std;
getopts(n);
if($opt_n){
open(OPT_LOG,/tmp/foo.txt) || die Could not open foo.txt!\n;
}
-Original
On 27 Mar 2002, Chas Owens wrote:
Getopt::Std creates the $opt_n variables. To use it with use strict; in
place you must use the use vars ($opt_n); pragma as well. or just use
the getopts('n', \%opts); call. Then you can say $opts{n}.
Agustin:
Also from the Getopt::Std man page:
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 3:18 PM
To: Beginners Perl Mailing List
Subject: Testing for filehandles
Hello, All:
I've looked around for an answer to this (The Camel Book, The
Ram Book,
perldoc
Owens [EMAIL PROTECTED]
To: Agustin Rivera [EMAIL PROTECTED]
Cc: Beginners Perl Mailing List [EMAIL PROTECTED]
Sent: Wednesday, March 27, 2002 1:51 PM
Subject: Re: Testing for filehandles
Getopt::Std creates the $opt_n variables. To use it with use strict; in
place you must use the use vars ($opt_n
On Wed, 27 Mar 2002, Agustin Rivera wrote:
Ok, I've tried it both ways and it returns 1 (true) as the value. What am I
doing wrong?
Agustin:
1. What *exactly* do you mean both ways?
2. References...
From the Getopt::Std man page:
getopt('oDI'); # -o, -D -I take arg. Sets
On Wed, 27 Mar 2002, Bob Showalter wrote:
You can pass a filehandle glob to IO::Handle::opened():
Thanks, Bob! After reading the IO::Handle man page, I decided to distill
this approach a bit further:
print F if fileno(F);
--
Eric P.
Los Gatos, CA
--
To unsubscribe, e-mail: [EMAIL
--- Alex Harris [EMAIL PROTECTED] wrote:
What is the best way, using rsh, to test if a directory
exists on another server?
Don't use rsh, it writes passwords on the back of postcards
and posts it to every employee in the building, possibily
outside it too.
Or in other words:
rsh DOES NOT
Well, I'm not sure about rsh, but with ssh:
ssh www.journalistic.com perl -e 'print ( (-d \data\) ? \DIR\n\ : \Not
DIR\n\ );'
Change data to whatever your dirname is...
Jason
If memory serves me right, on Friday 01 February 2002 10:18, Alex Harris
wrote:
What is the best way, using rsh, to
Hi all,
I am trying to test three variables in an 'if' statement eg:
if ($a eq abc and $b eq efg and $c eq hi)
{
do some code .
}
how do i do this in perl
Thanks in advance
Anadi
_
Send and receive Hotmail on your
Hi Anadi,
Hope this helps:
#!/tools/bin/perl -w
print enter a number\n;
$a = STDIN;
if ($a == 12 or $a== 8) {print right\n;}
else {print incorrect\n;}
#end of script
-vicky
--- A Taylor [EMAIL PROTECTED] wrote:
Hi all,
I am trying to test three variables in an 'if'
statement eg:
if
.
if ($answer eq N or $answer eq NO) {
fatal_error(Error message.);
}
-Andrea
-Original Message-
From: A Taylor [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 11:57 a
To: [EMAIL PROTECTED]
Subject: help needed with testing variable in an if statement
Hi all,
I am
wow, thanks. this is the closest to what i wanted to do first, so i'll
use this.
my $response = 0;
while ( $response != 1 and $response != 2 and $response != 3 ) {
print What would like to do?\n;
print 1. Start a new file\n;
print 2.
Hey everybody. I have a simple problem that has been stumping me. I'm
using Perl 5.6.1 on Mac OS X 10.1.1. This is a sub for opening a file in
my program. this is the sub, and the problem is when i run it, if i do
not enter a number 1-3, it keeps asking me forever to enter a number.
Even if
other statements here };
}
-Original Message-
From: Chris Zubrzycki [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 18, 2001 4:45 PM
To: [EMAIL PROTECTED]
Subject: testing input/loops
Hey everybody. I have a simple problem that has been stumping me. I'm
using Perl 5.6.1 on Mac OS X
--- Chris Zubrzycki [EMAIL PROTECTED] wrote:
Hey everybody. I have a simple problem that has been stumping me. I'm
using Perl 5.6.1 on Mac OS X 10.1.1. This is a sub for opening a file in
my program. this is the sub, and the problem is when i run it, if i do
not enter a number 1-3, it
This doesn't do what you think it does.
unless ($response eq '1' || '2' || '3')
It says, unless the response was eq to 1, or if 2 is true, or if 3 is true.
2 and 3 are true by definition so this will always be true. I think you
want
unless ($response eq '1'
or
201 - 300 of 325 matches
Mail list logo