Richard Lee <[EMAIL PROTECTED]> asked:
> What is the best way to indicate past hour from current time
> without using a module?
[...]
#!/usr/bin/perl -w
use strict;
printf "%d:%02d to %d:%02d\n", (localtime time - 3600 )[2,1], (localtime
time)[2,1];
__END__
> my $time = localtime;
> my @tim
On Wed, Apr 2, 2008 at 2:24 AM, Jeff Pang <[EMAIL PROTECTED]> wrote:
> On 4/2/08, Chas. Owens <[EMAIL PROTECTED]> wrote:
> > On Wed, Apr 2, 2008 at 2:02 AM, Jeff Pang <[EMAIL PROTECTED]> wrote:
> > > On 4/2/08, Richard Lee <[EMAIL PROTECTED]> wrote:
> > > > What is the best way to indicate past
On 4/2/08, Chas. Owens <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 2, 2008 at 2:02 AM, Jeff Pang <[EMAIL PROTECTED]> wrote:
> > On 4/2/08, Richard Lee <[EMAIL PROTECTED]> wrote:
> > > What is the best way to indicate past hour from current time without
> > > using a module?
> > >
> > > so if it's
Richard Lee wrote:
What is the best way to indicate past hour from current time without
using a module?
so if it's 12:00, then 11:00-12:00
if it's 17:30 then 16:30 to 17:30
if it's 00:30 then 23:30 to 00:30
I wrote a below program and works but there has to be a better and
easier(not sure i
On Wed, Apr 2, 2008 at 2:02 AM, Jeff Pang <[EMAIL PROTECTED]> wrote:
> On 4/2/08, Richard Lee <[EMAIL PROTECTED]> wrote:
> > What is the best way to indicate past hour from current time without
> > using a module?
> >
> > so if it's 12:00, then 11:00-12:00
> >
>
> I'd prefer using POSIX modul
On 4/2/08, Richard Lee <[EMAIL PROTECTED]> wrote:
> What is the best way to indicate past hour from current time without
> using a module?
>
> so if it's 12:00, then 11:00-12:00
>
I'd prefer using POSIX module since it's a built-in perl module.
The code would be simple,
use strict;
use POSIX 'str
What is the best way to indicate past hour from current time without
using a module?
so if it's 12:00, then 11:00-12:00
if it's 17:30 then 16:30 to 17:30
if it's 00:30 then 23:30 to 00:30
I wrote a below program and works but there has to be a better and
easier(not sure if I want easier as I
On Mar 29, 3:19 pm, [EMAIL PROTECTED] (John W. Krahn) wrote:
> [EMAIL PROTECTED] wrote:
> > When I do string comparisons in perl the strings seem to ignore the
> > embedded hyphens.
> > I want to sort strings assuming the 'dictionary' order of the chars is
> > ASCII order: hypen, 0-9, A-Z.
> > It a
[EMAIL PROTECTED] schreef:
> John W. Krahn:
>> It appears to work in Perl:
>>
>> $ perl -le'@x = qw[22 2-2 2-3 23 21]; print for sort @x'
>> 2-2
>> 2-3
>> 21
>> 22
>> 23
>
> I'm looking for the perl way of comparing strings.
>
> Your posted code 'diff says memory exhausted need help with perl
>
> I did the following:
> perl Makefile.PL PREFIX=/u/basappas/local/perl/Algorithm-Permute-0.06
That's probably where you've got the Algorithm-Permute source - I'm
not so sure it's a good idea to install the module into the source
folder, but if you want to do that then next run 'make test', follow
On Tue, Apr 1, 2008 at 5:17 PM, yitzle <[EMAIL PROTECTED]> wrote:
> On Tue, Apr 1, 2008 at 4:03 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> > yitzle wrote:
> > > Is there some way to convert it (a string/scalar) to an array?
> >
> > Is this what you mean?
> >
> > my $string = 'ABCDEF';
> >
2008/4/1 Jay Savage <[EMAIL PROTECTED]>:
snip
> my ($last) = $number =~ /.*(\d)/;
>
> Let Perl worry about what is and isn't a digit.
snip
Unfortunately, with the rise of UNICODE, \d is no longer what one
expects* ([0-9]). It now includes all characters marked as digits in
UNICODE. This inc
On Tue, Apr 1, 2008 at 4:03 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> yitzle wrote:
> > Is there some way to convert it (a string/scalar) to an array?
>
> Is this what you mean?
>
> my $string = 'ABCDEF';
> my @string = split '', $string;
>
>
>
> Rob
I suppose. That can be used to extract th
yitzle wrote:
> Is there some way to convert it (a string/scalar) to an array?
Is this what you mean?
my $string = 'ABCDEF';
my @string = split '', $string;
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Is there some way to convert it (a string/scalar) to an array?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Tue, Apr 1, 2008 at 11:09 AM, Rob Dixon <[EMAIL PROTECTED]> wrote:
[snip]
>
> my ($lastdigit) = $number =~ /.*([0-9])/;
>
> gives you the last decimal digit (even if there are non-decimals after
> it).
>
Better yet:
my ($last) = $number =~ /.*(\d)/;
Let Perl worry about what is and
John W. Krahn wrote:
> [EMAIL PROTECTED] wrote:
>> Hi,
>
> Hello,
>
>> How do I extract the last digit of a number? example I only want the digit 9
>> from the number 19.
>>
>> my $number = 19;
>
> my $last_digit = chop $number;
Yes, although it's important to note that that method removes the
[EMAIL PROTECTED] wrote:
Hi,
Hello,
How do I extract the last digit of a number? example I only want the digit 9
from the number 19.
my $number = 19;
my $last_digit = chop $number;
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools
[EMAIL PROTECTED] wrote:
>
> How do I extract the last digit of a number? example I only want the
digit 9 from the number 19.
>
> my $number = 19;
There are a few ways.
my $lastdigit = substr $number, -1;
gives you the last character in the string
my $lastdigit = $number % 10;
gives you t
Hi,
How do I extract the last digit of a number? example I only want the digit 9
from the number 19.
my $number = 19;
Sharan Basappa wrote:
>
> I have installed permute module locally and added the path to my script.
> However, perl fails to find the module.
>
> The script:
> #!/usr/bin/perl
> use lib "/u/basappas/local/perl/Algorithm-Permute-0.06";
> use Algorithm::Permute;
> my @array = (1..9);
> Algorithm::Per
I have installed permute module locally and added the path to my script.
However, perl fails to find the module.
The script:
#!/usr/bin/perl
use lib "/u/basappas/local/perl/Algorithm-Permute-0.06";
use Algorithm::Permute;
my @array = (1..9);
Algorithm::Permute::permute { print "@array\n" } @array;
Hi,
There is a small problem now :
It now copies the files as directories :
#!/usr/bin/perl
$startDir = q{c:\test};
$newDir = q{c:\new};
&myReadDir($startDir);
exit 0;
sub myReadDir
{
my ($dir) = @_;
print "\n\nProcessing $dir \n" ;
my (@di
alok nath wrote:
Hi,
Hello,
I wanted to recursively copy the contents of a directory(both directory
and files) from one folder to the other.
The below code does only copy of directories but leaves behind files.
Can anybody help me how to do that ?
http://search.cpan.org/~dmuey/File-Copy-Rec
On 4/1/08, alok nath <[EMAIL PROTECTED]> wrote:
> Hi,
> I wanted to recursively copy the contents of a directory(both directory and
> files) from one folder to the other.
use File::Copy from CPAN.
> The below code does only copy of directories but leaves behind files.
>@dirs=grep {!(
Hi,
I wanted to recursively copy the contents of a directory(both directory and
files) from one folder to the other.
The below code does only copy of directories but leaves behind files.
Can anybody help me how to do that ?
Regards,
Alok
#!/usr/bin/perl
$startDir = q{c:\test};
$newDi
26 matches
Mail list logo