I'd like a more succinct and
cleaner method of doing this though, if possible.
Any ideas?
Mathew
Why not just declare @array like this:
my @array = ("All", "A - H", "I - P", "Q - Z");
and then later push new variables onto it, like so:
push @array, qw
John W. Krahn wrote:
Flemming Greve Skovengaard wrote:
Travis Thornhill wrote:
I need to make strings of variable length for testing inputs.
The strings can contain any letter, say 'a', and I need to be able
to create the string with
255, 256 or any length.
Is there a quic
+1 );
for (1..$length) {
$index = int rand(scalar @letters-1);
$rand_string .= $letters[$index];
}
print $rand_string, "\n";
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPowerThe world is doomed to d
is
happen and how to resolve it.
Thank you very much.
I believe it is because the months are 0-indexed (0-11), so
timelocal(0,0,0,31,8,2006) is 2006-7-31 *not* 2006-8-31.
It also say so in the documentation.
perldoc Time::Local
Hope it helps.
--
Flemming Greve SkovengaardThe kille
Joshua Colson wrote:
On Thu, 2006-06-08 at 00:55 +0200, Flemming Greve Skovengaard wrote:
If you are just going to print the day number and you have other dates in a
similar format why not just use:
print +(split /\s+/, $date)[2];
Well, in this particular instance, I am. However, there have
ther dates in a
similar format why not just use:
print +(split /\s+/, $date)[2];
--
Flemming Greve SkovengaardThe killer's breed or the Demon's seed,
a.k.a Greven, TuxPowerThe glamour, the fortune, the pain,
<[EMAIL PROTECTED]> Go to war again, bl
nday and 3 indicat-
ing Wednesday. $yday is the day of the year, in
the range 0..364 (or 0..365 in leap years.)
$isdst is true if the specified time occurs during
daylight savings time, false otherwise.
Hope it helps.
--
Flemming Greve Skoveng
d ).
Else you get "Variable "$sym" is not imported at ..." when using 'use strict;'
( as you should ).
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPowerThe world is doomed to die
<[EMAIL PR
/;
}
the running result is:
"http://test"; is valid.
"http://"; is valid.
"www" is valid.
"ftp:/foo" is valid.
why "http://"; and "ftp:/foo" can pass the check?
Because ((http|ftp):\/\/) is optional ( the ? following it does that ),
s
! India Matrimony: Find your life partneronline.
Post your code if you want help, most of us don't have psychic powers :)
--
Flemming Greve SkovengaardThe killer's breed or the Demon's seed,
a.k.a Greven, TuxPowerThe glamour, the fortune, the pain,
&l
ck solution could be:
my $counter = 0;
while (my $img_tag = $parser->get_tag('img')) {
++$counter;
my $i = $img_tag->[1]; # attributes of this img tag
my $code = $i->{'src'};
if($counter == 11) {
print "$code\n";
Perl guru,
you know, while I can't answer why one work and the other doesn't someone else
on the list might.
And again, please bottompost.
--
Flemming Greve Skovengaard FAITH, n.
a.k.a Greven, TuxPower Belief without evidence in what is told
<[EMAIL PROTECTED
Bastian Angerstein wrote:
Joop,
if I use open... or die "$!" i see that the file is opened correctly but nothing is in
$_.
-UrsprÃngliche Nachricht-
Von: Flemming Greve Skovengaard [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 26. Oktober 2004 11:45
An: [EMAIL PROTECTED]
C
Bastian Angerstein wrote:
Why does this donÂt work in my Script?
open (TEST, ") {
print $_;
# or just
print;
}
Does the file exists and can you read it?
--
Flemming Greve SkovengaardThe killer's breed or the Demon's seed,
a.k.a Greven, TuxPowerT
ne 12.
Global symbol "$dir" requires explicit package name at ./checksum.pl
line 14.
Good, now you're on the right track. Declare those variables ( with my ) and
read the reply by John W. Krahn.
--
Flemming Greve SkovengaardThe prophecy of th
bin/bash
0 /bin/bash2
0 /bin/cat
0 /bin/chgrp
0 /bin/chmod
thanks
Try to add this lines somewhere the top of the file:
use strict;
use warnings;
and report the errors, if any.
--
Flemming Greve Skovengaard Just a few small
he $msg2. How?
Regards
Sreedhar
$msg2 = "";
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPowerA tale of death and doom
<[EMAIL PROTECTED]> Odin saw the final sign
4112.38 BogoMIPS
e and
from here ->[%pne%]<- to here. I can recommed Mastering Regular Expressions
form O'Reilly if you want to learn more.
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPowerThe world is doomed to die
<[EMAI
$_\n" } keys( %HoH );
Remember that a hash stores its keys/values in random order, so you will get
your keys in random order.
given the construction variables as mention before.
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPower
of uninitialized value in concatenation (.) at ./pingcheck line 7.
Use of uninitialized value in pattern match (m//) at ./pingcheck line 8.
^C
[EMAIL PROTECTED] gary]$
Don't you mean 'ping -n -c 50 10.1.1.31' instead of 'ping -n 50 10.1.1.31'.
Else read the man page for ping.
--
that if I throw the array to another sub also means the
array would be copied and then pass to the target sub ?
Yes
while reference is using the same data in system memory?
Yes
Thanks
--
Flemming Greve Skovengaard FAITH, n.
a.k.a Greven, TuxPower Belief without evi
r numerals
as such :- 20040814
Can someone help me with that regex? I am having a frustrating time of
it!
Much appreciated
Denham
--
Flemming Greve Skovengaard Man still has one belief,
a.k.a Greven, TuxPower One decree that stands alone
<[EM
substr( $dato, 0, 2 ) ) );
}
while ()
if ( $_ =~ $foodate) {
It would work, if you use sprintf as shown above. But I would write:
if ( $_ =~ m/$foodate/ )
instead to eliminate confusesing when maintaining the code later.
.
}
--
Flemming Greve Skovengaard FAITH, n.
a.
Bob Showalter wrote:
Flemming Greve Skovengaard wrote:
printf ("%02d/%02d/%02d\n", $month + 1, $day, $year - 100);
# Only works when $year > 1999.
And when $year <= 2099 :~)
Stick to $year % 100;
Yes, you are correct. Your solution is fool proof.
--
Flemming Greve Skovengaard
o load the Posix module?
also, why I ntoiced I had to may $month+1 otherwise it outputs a month
back. why is this?
thanks,
derek
printf ("%02d/%02d/%02d\n", $month + 1, $day, $year - 100);
# Only works when $year > 1999.
Try 'perldoc -f localtime' to learn why this wor
--
t/GD.t108 80.00% 2-7 9-10
1 subtest skipped.
Is this serious enough to make GD not work?
BTW, I am using:
Slackware 9.1 with kernel 2.6.7
Perl 5.8.4
and I have all the prerequisites for building GD from source.
--
Flemming Greve Skovengaard FAITH
t by "check out" is download and install.
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPowera tale of death and doom
<[EMAIL PROTECTED]> Odin saw the final sign
4112.38 BogoMIPS
oesn't works neither does
No, because 'foo bar' is two arguments, arguments is separated by spaces.
./count.pl "foo bar" works
Yes, "foo bar" is one argument.
How do I write this the right way?
My way works, 'cause I'm always right :)
No seriously TIMTO
$ENV{"ORACLE_HOME"}="/orav101/oracle/8.1.7";
use strict;
use DBI;
use lib '/home/samcsm/jason/myperl/lib/perl5/site_perl/';
Use this one-liner to check your environment variables:
perl -Mstrict -we 'foreach my $key (sort keys %ENV) { print "$key =>
m
dateme( );
#---
sub dateme{
my $process_date=' ';
$process_date=localtime( );
return $process_date;
}
There is no problem in this sample code.
But somewhere else in your program you must use $process_date without
declaring it first.
--
Flemming Greve SkovengaardThe k
Jaffer Shaik wrote:
Dear Friends,
My OS is unix.
Using perl, I want to read a pdf file and print its contents.
How can I achieve this using perl.
Regards,
Jaffer.
http://search.cpan.org/
Search for PDF
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven
ct me if I am wrong) you're bound
to get repeated numbers. If you only want non-repeating numbers, run through
the array and only unshift if the number is not in the array already.
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPower
ble called $i_.
Changed '$b="$i_".$j*2;' to '$b="${i}_".$j*2;'
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPowera tale of death and doom
<[EMAIL PROTECTED]>
#x27;, Why ?
Thanks, Francois
Because $TTT is undef.
When you declare $TTT i Tt perl creates a new variable and hides away the $TTT
from the "main" part of your script to be restored when Tt returns.
Change 'my $TTT;' in Tt to my '$TTT = shift;' and call Tt like t
-f join" for the latter one.
or
$string =~ s/(?
--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPowerthe world is doomed to die
<[EMAIL PROTECTED]> fire in the sky
4112.38 BogoMIPS
the past 3 years).
--
Flemming Greve SkovengaardThe killer's breed or the Demon's seed,
a.k.a Greven, TuxPowerThe glamour, the fortune, the pain,
<[EMAIL PROTECTED]> Go to war again, blood is freedom's stain,
4168.08 BogoMIPS
r tar), then
cd module_name
make
make test
make install
FOR WINDOWS:
You're on your own :)
--
Flemming Greve Skovengaard Just a few small tears between
a.k.a Greven, TuxPower Someone happy and one sad
<[EMAIL PROTECTED]> Just a thin line drawn
e you using?
If you are on a Linux system, it would be:
tar -zxvf module_name.tar.gz
make
make test
make install
Otherwise I don't know.
--
Flemming Greve Skovengaard Just a few small tears between
a.k.a Greven, TuxPower Someone happy and one sad
<[EM
.
It is easy to understand, very well written and covers all the basic Perl,
so it should get you started.
--
Flemming Greve Skovengaard Be it the Devil or be it him
a.k.a Greven, TuxPower You can count on just one thing
<[EMAIL PROTECTED]> When t
:
my @file_list =
to
my @file_list = <*.txt>
or
my @file_list = glob "*.txt"
--
Flemming Greve Skovengaard FAITH, n.
a.k.a Greven, TuxPower Belief without evidence in what is told
<[EMAIL PROTECTED]> by one who speaks without knowl
uot;;
chomp($name = );
$org_name = $name;
$name =~ s/[^A-Za-z]\w*//g; #change 1
$name =~ tr/A-Z/a-z/; #change 2
print "Old = $org_name\n";
print "New = $name\n";
__END__
--
Flemming Greve SkovengaardAnd when you kill a man, you're a murderer
a.k.a Greven,
e, $blocks) = stat($file);
$create_time = localtime($ctime);
$times[$i] = $create_time;
$i++;
}
@sorted_times = sort(@times);
my $this_time;
foreach $this_time (@sorted_times) {
my($day, $mon, $dt, $tm, $yr) = split /\s+/,$this_time;
my ($hr, $mn, $sec) = split /:/, $tm;
print "$this_time\n&qu
See the BUGS
manpage."
http://danconia.org
[snip]
--
Flemming Greve SkovengaardThe killer's breed or the Demon's seed,
a.k.a Greven, TuxPowerThe glamour, the fortune, the pain,
<[EMAIL PROTECTED]> Go to war again, blood is freedom's stain,
clues?
Thank you so much in advance,
Best regards,
Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestieres
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED]
--
Flemming Greve SkovengaardAnd when you kill a man, you're a murderer
a
44 matches
Mail list logo