As I understood, only parts containing a dot should be considered to be filenames. So you could take this script as a start:
#!/usr/bin/perl -w
use strict;
my @urls = qw(http://123.domain.123 http://123.domain.123/Dir http://123.domain.123/file.ext http://123.domain.123/Dir/file.ext...
Just a hint:
$item =~ s/\x160$//g
could not work, because after "\x" you need to give a hexadecimal value, not a decimal one.
160 decimal is A0 hexadecimal =>
$item =~ s/\xA0+$//o
should discard the characters in question (and no others).
Hi Graham,
if you work under Unix/Linux, another solution could be to invoke the shell, as the -t option of ls sorts the files by date descending. As ls returns the total size in the first line, we just need to filter out the second line.
my $latest_file = `ls -t ~/proj/test | head -2 | tail...
I'd recommend the Parse_Date routine from Date::Calc:
#!/usr/bin/perl -w
use strict;
use Date::Calc qw(Parse_Date);
my $date = 'Mon Aug 1 08:07:21 -0700 2005';
my ($year,$month,$day) = Parse_Date($date);
print "$year-$month-$day\n";
Holger
I've never installed/used it, but maybe WebFS::FileCopy might help you?
see http://www.cpan.org/modules/by-module/LWP/BZAJAC/WebFS-FileCopy-1.04.readme
For the pinging, maybe forking could be of some help.
Holger
Looks as if Kevin is totally right:
#!/usr/bin/perl -w
use strict;
my @strings = (" foo ", " bar ", " foo bar ");
for (1..100000) {
foreach my $string (@strings) {
$string =~ s/^\s+//;
$string =~ s/\s+$//;
}
}
results in
real 0m1.021s
user 0m1.000s
sys...
Hi extension,
I suppose you're looking for something like this?
#!/usr/bin/perl -w
use strict;
my @patterns = ();
my %seen = ();
# We create a list of all patterns we wish to find
foreach my $expression ("livvy lump-beach", "orangesty") {
foreach my $part (split(/\s+/, $expression)) {...
Hi Keith,
I personally prefer date-time entries in the database, so I understand the entries at first glance. For fast conversion UNIX_TIMESTAMP(date) can be used (see http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html) to calculate in epoch seconds, but in fact I often calculate...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.