Re: having problems with index of a date string

2005-11-16 Thread Dave Gray
On 11/11/05, kathyjjja [EMAIL PROTECTED] wrote:
 I am trying to add the date to a file name.
[snip]

Usually when I want to do something like this, it's to make a uniquely
named temp file, so the date doesn't need to be human readable, so
something like this works just fine:

# filename_processid_epoch seconds
my $tmpfile = '/var/tmp/prefix_'. $$ .'_'. time;

Just a thought. Simpler (than having to parse a string-formatted
date), which is always good.

Cheers,
Dave

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: having problems with index of a date string

2005-11-11 Thread kathyjjja
It certainly must be Friday. I have this working now. Sorry. 

kathyjjja [EMAIL PROTECTED] wrote:Hello everyone,

I am trying to add the date to a file name. I finally got rename to work, but 
now I am having problems with indexing the date string. Index works fine on any 
other string, but for some reason it is not seeing the characters in date. Here 
is the code:

my $where
my $dateTime = localtime;
print dateTime = $dateTime\n;
# dateTime looks like this: Fri Nov 11 14:59:49 2005
$where= index($dateTime, N);
print where = $where\n;

index() cannot find anything in the $dateTime string. I am thinking that this 
data is actually stored in another format and when you ask for it to be 
printed, it formats it nicely for you automatically. If that is true, how can I 
get a date as a string that I can manipulate?

Thanks,
Kathy


-
Yahoo! FareChase - Search multiple travel sites in one click. 


-
 Yahoo! FareChase - Search multiple travel sites in one click.  

Re: having problems with index of a date string

2005-11-11 Thread Stephen Mayer
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kathy,

 I'm not sure exactly what problem you are having.  When I ran your code below 
(after putting a
semi-colon after `my $where`), I got the result of `where = 4` which is the 
index of the letter N in
the $dateTime string.  What is it you are expecting to see?

Steve

kathyjjja wrote:
 Hello everyone,
  
 I am trying to add the date to a file name. I finally got rename to work, but 
 now I am having problems with indexing the date string. Index works fine on 
 any other string, but for some reason it is not seeing the characters in 
 date. Here is the code:
  
 my $where
 my $dateTime = localtime;
 print dateTime = $dateTime\n;
 # dateTime looks like this:  Fri Nov 11 14:59:49 2005
 $where= index($dateTime, N);
 print where = $where\n;
  
 index() cannot find anything in the $dateTime string. I am thinking that this 
 data is actually stored in another format and when you ask for it to be 
 printed, it formats it nicely for you automatically. If that is true, how can 
 I get a date as a string that I can manipulate?
  
 Thanks,
 Kathy
 
   
 -
  Yahoo! FareChase - Search multiple travel sites in one click.  

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDdPy7C4cakfkZLXQRAn6jAJwN1sAzhJWyjOA5nWCMo2r7B39vdQCdEynO
P4hPaK2WUkdKCYRW+vdHNws=
=ni5O
-END PGP SIGNATURE-

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response