My goal is to get element 9 of stat which is mtime. I am getting this
with
ease, but my end goal is to convert this number back into a readable
format
giving me how old the file is.
So here is a rough draft formula : (time in seconds - last MTime ) =
seconds old.
Convert seconds old to a
On Mon, 18 Apr 2005, Anish Kumar K wrote:
Can [anyone] suggest a good algorithm for [encrypting] and
[decrypting] files ..I donot want to use any perl module for that...
Check out the perl stuff on this site. I haven't actually used it yet,
though I've been meaning to look at it. But their
Hi All,
The code below does what I want to do, but it takes 3 lines and a temporary
array (yuck). I can't come up with a one line regex substitution. Anyone
got one?
my $tmp = reverse split //, $_;
$tmp =~ s/-//;
$_ = reverse split //, $tmp;
TIA,
Peter
** CONFIDENTIALITY NOTICE **
[EMAIL PROTECTED] wrote:
Hi All,
The code below does what I want to do, but it takes 3 lines and a
temporary
array (yuck). I can't come up with a one line regex substitution.
Anyone
got one?
my $tmp = reverse split //, $_;
$tmp =~ s/-//;
$_ = reverse split //, $tmp;
can you post a sample
If you just want to remove the last occuring '-' character, then the
following would work.
s/(.*)-(.*)/$1$2/;
Well, huh. That does work. Though it reminds me only of how little I
understand why.
Thanks, you've made it look easy.
** CONFIDENTIALITY NOTICE **
NOTICE: This e-mail
Is there a correct way to define a default case within a SWITCH? I tried
with
the bottom case, but that errors with:
Quantifier follows nothing before HERE mark in regex m/* HERE / at
./ctest line 251.
SWITCH:
{
$field =~ /^CR\d{0,7}$/ do
{
$openCRs++;
print tda
I thought it was only called 'string' in Applesoft...
Glad to hear I'm not the only one. My co-workers think I'm crazy.
|-+
| | Paul Kraus |
| | [EMAIL PROTECTED]|
| | .com|
| |
This seems to work, although there are some odd line returns and '0' is
being returned as '0.'
Still, I can work around that, THANKS!
|-+
| | zsdc [EMAIL PROTECTED]|
| ||
| | 08/21/2003
True, it's not a Perl issue (I've been able to duplicate the problem in C,
and Scheme), but I'm looking for a Perl solution. Math::BigFloat seems to
work well enough.
Thanks,
Peter
|-+
| | Levon Barker |
| | [EMAIL
Luckily I was easily able to recreate the problem. See code below:
print 37.75 - 33.67 - 4.08 ;
STDIN;
I find these things all the time. Is there a particular module I can use
to fix these things?
Output is
-1.77635683940025e-015
Should be 0
Running on Win2000 / Intel P3
Hi Bob,
I'm doing data-processing (EDI). I need to format and present values in
text, round here and there. Have lots of various attempts that have failed
for one math related reason or another. Currently I convert to a string
and split and round, etc. (Even modulo '%' has failed me at
Hi All,
It seems like I should know this, but I don't, and I can't seem to find it
written anywhere.
I need to check disk space on an NT platform using ActiveState Perl 5.6.1.
Is there an easy way to do this?
Thanks,
Peter
** CONFIDENTIALITY NOTICE **
NOTICE: This
Hi David,
I'm using Active State 5.6.1 build 631 on NT 4.
This problem appears to be connected to the level of network traffic. But
two things stand out. The files are on average only 12K, and the previous
process had it's problems, but not this one. It was running on the same
box, but was
Hi All,
I'm unsure what to do next. I hope someone has beaten this before and
hears my cry for help.
I've implemented a script to transfer files to a client, and to pick files
up. There is a firewall, though I don't know much about it. I instantiate
the Net::FTP object with Passive = 1.
The
Hi Joseph,
Probably just as well. Is there some context where you anticipate having
to repair broken keys after the fact?
In this case I'm building packages, and don't want to count on the user to
get the case of the text correct when passing the values. So if I need to
set the 'smile'
Hi All,
I'm passing a hash to a subroutine like this:
subname(a = 123, b =fff, C = joyjoyjoy);
On the receiving side I want all keys to be upper case. I can map like
this:
sub subname{
map {$_ =~ tr/a-z/A-Z/} @_;
my %values = @_;
..
}
and I
First, please don't use map in a void context for its side effects.
Uh oh... What side effects? I use map like this all the time! What dread
is looming in my future?
Just loop it:
sub subname {
my %values;
while (@_ = 2) {
my ($key, $value) = splice @_, 0, 2;
Replace
EVIL: map { some;block;of;code;that;changes;$_ } @some_array;
with
GOOD: for (@some_array) { some;block;of;code;that;changes;$_ }
I guess I don't get it. Map returns a value and I ignore it; so what?
What side effects does this have? Which one's faster? I like to avoid
obvious
The foreach loop *will* be faster.
Good enough for me!
Thanks,
Peter
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
use File::Slurp
$file1 = read_file($fileone);
$file2 = read_file($filetwo);
write_file($filenew,$file1\n$file2)
Thanks Dan,
It's that easy!
-Peter
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi All,
Sorry if this is a stupid question. It took me awhile to figure out I
could use the File::Copy module to copy a file, and this is about the same
level of ignorance.
Is there an easy way to concatenate two (text) files in Perl, short of
opening two to read and one to write and then loop
Hi All,
I'm hoping someone has done this before. I need to spawn 3 processes and
then wait for all three to finish.
spawn like this:
my $obj;
my $appname = $perl;
my $cmdline = $deliverscript $arg;
my $iflags = 1;
my $cflags = CREATE_NEW_CONSOLE |
but how can I tell when all three are finished? If I use
$obj1-Wait(INFINITE);
$obj2-Wait(INFINITE);
$obj3-Wait(INFINITE);
what happens if $obj2 finishes before $obj1?
looks like this works fine...
PHF
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
I've played
tag the wall with the forehead long enough.
a) a way to name a hash from user input
If you mean assign a value with in a hash using the user input, then:
my %hash
$key = STDIN;
$val = STDIN;
$hash{$key} = $val;
If you really want to let the user name
Thanks to all who replied.
|-+
| | Rob Dixon |
| | [EMAIL PROTECTED]|
| | m.co.uk |
| ||
| | 02/07/2003 05:09 |
| | PM
Oops, hit send by mistake. This problem all seems to be about mistakes...
Thanks to all who replied.
You have three different hashes in use. Look:
I did indeed have 3 hash tables... Duh (Must have been Friday afternoon).
The central problem was calling '{${$date_format{$format}}{now}}()'
if (@Af1 eq @Af2) { print Files compare okay\n; }
else { print Files differ\n; }
#
How about something clunky like this:
if (join(,@Af1) eq join(,@Af2)) { print Files compare okay\n; }
else { print Files differ\n; }
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
Hi All,
I swear I've called subroutines this way before, but I can't find any
examples.
In this case, I'm looking to build some time/date functions. Regardless of
what the actual code is supposed to do, the calling of subroutines as
elements of a hash is causing me grief. I am receiving the
Trying it now from the Command Prompt.seems to be just 'sitting'
there.
Hi Tony,
If you're still having trouble getting the package, it could be a firewall
issue. I have to download packages, then install from my local box because
of corporate B()[[S][|~!.
I believe this is the correct
I have a list of inspection stations in a data file which is
comma-separated. It contains the following data, in order:
Station Name, Address 1, Address Line 2, City, State, Zip, Phone Number
I need to group the lines (of address information) by city and get a count
of the number of stations in
Hi All,
I'm playing with record formats. I need to be able to have more than one
kind of delimited
format available at one time. I've written a sort routine to get the
values in the order
I want, but it assumes one variable name (in this example that is
%delimited format). I want
something a
I have installed Perl 5.6.1 ( which works ) and Tcl/Tk 8.3 (
which
works ) on Windows 2000 but when I try to perl -e use Tk I get the
following error:
Can't locate Tk.pm in @INC ( @INC contains: D:/Perl 5.6.1/lib
D:/Perl 5.6.1/site/lib . ) at -e line 1.
Have you
Hi,
The 'cc' and 'bcc' methods in Net::SMTP seem to simply alias the 'to'
method. How do I actually 'cc' and 'bcc' in Net::SMTP? I tried putting
these in the DATA area (though it doesn't really make sense to me to do it
that way). I even looked through RFC 822 and 2821 for hints... but I
Just like that. Thanks for demystifying that for me.
|-+
| | George |
| | Schlossnagle|
| | [EMAIL PROTECTED]|
| | m |
| |
Hi there,
I hope this is a trivial newbie problem:
I know how to open a pipe to another program:
open (OUT, |perl .\\bogus.pl) or warn Unable to open pipe to
bogus.pl\n;
print OUT Stuff\n;
And I know how to open a pipe from another program:
open (IN, perl .\\bogus.pl|) or
If *nix, look at help for the open3 function. Attached as a text file is
the little run class that I use to do this.
Here is an example of how to use this class to encapsulate GPG, where
the passphrase gets written to stdin of the child process, and the
results are reaped from the childs
Hello Everyone,
I am writing a utility that needs to index the files contained within
about 500 directories (some nested). I want to provide the script with a
top directory and have it recurse through everything underneath while
indexing the files within each. I've searched Google and can't
Hi all,
Here is the code I'm having problems with:
my @arr = glob($here\\*);
foreach $val (@arr){
if (-d $val){
travel_dirs($val, $level-1) if $level 0;
}else{print$val\n;}
}
'else print $val' is just there for debugging, so I can
in windows:
ppm query
Jaimee
Spencer
The book from O'Reilly, Perl DBI, chapter 2, has a good look at
Data::Dumper and other approaches that could work here.
Jonathan E.
I've been growing interested in the Tk module too. I found this today.
It's really really introductory.
http://www.perl.com/pub/a/1999/10/perltk/
I've seen this effect when using data I copied off the internet (using
Explorer) into a text file in a Unix environment. In my case the problem
was definitely a control character within the string causing a line return
without a line feed. It didn't show up when I viewed the file with less or
Now I can!
Timothy
Johnson To:
I am on NT, trying to use 'PPM INSTALL DBI' and receiving an error message:
Error installing package 'DBI': Could not locate a PPD file for package
DBI:
Very frustrating. I have yet to succeed with PPM.
I know there is a firewall here, is that possibly the problem? Are there
config scripts or
In my case, PPM has been working. PPM QUERY returns a list of the modules
that were initially installed. But the error comes each time I try to
install new modules with PPM:
Installing package 'DBI'...
pause
Error installing package 'DBI': Could not locate a PPD file for package DBI
I assume
Awesome Timothy! You are Awesome!
I haven't fixed the Proxy problem, but I copy-pasted the HTTP_PROXY
variable name from your email into the search box at ActiveState.com and it
gave me a link to a doc that says it can help solve the problem.
Unfortunately the network guys went home already.
I'll try and keep it short. I have code that opens an Oracle client and pipes
it a few SQL statements, including spool.
I've heard a lot about 'use strict' and I felt that my code was actually
organized well enough to pull this off, so I tried it.
The only change I made was to declare all
how about system(some command line); ?
|+---
|| [EMAIL PROTECTED]|
|| m|
|| |
|| 06/08/01 |
|| 09:45 AM |
|| |
Hi,
I've got a Perl script that logs into one of our applications as Admin. I
didn't want to hard code in the password, so I'm prompting for it. I was
looking for a way to hide the input, just like when you log into a Unix or NT
box. I was hoping to either have the actual input chars
49 matches
Mail list logo