Re: qw with strings containing spaces

2007-08-09 Thread Flemming Greve Skovengaard
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

Re: How do I create this string?

2007-03-20 Thread Flemming Greve Skovengaard
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

Re: How do I create this string?

2007-03-19 Thread Flemming Greve Skovengaard
+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

Re: Time::Local let me faint

2006-08-29 Thread Flemming Greve Skovengaard
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

Re: regex to match a range of numbers

2006-06-08 Thread Flemming Greve Skovengaard
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

Re: regex to match a range of numbers

2006-06-07 Thread Flemming Greve Skovengaard
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

Re: Date difference.

2006-04-06 Thread Flemming Greve Skovengaard
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

Re: A Strange Syntax

2005-12-05 Thread Flemming Greve Skovengaard
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

Re: regex puzzle

2005-07-29 Thread Flemming Greve Skovengaard
/; } 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

Re: Internal server error

2005-02-08 Thread Flemming Greve Skovengaard
! 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

Re: LWP get_tag('img')

2004-12-09 Thread Flemming Greve Skovengaard
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";

Re: Reading from a filehandle in while-loop

2004-10-26 Thread Flemming Greve Skovengaard
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

Re: Reading from a filehandle in while-loop

2004-10-26 Thread Flemming Greve Skovengaard
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

Re: Reading from a filehandle in while-loop

2004-10-26 Thread Flemming Greve Skovengaard
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

Re: problem printf

2004-10-26 Thread Flemming Greve Skovengaard
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

Re: problem printf

2004-10-25 Thread Flemming Greve Skovengaard
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

Re: How to empty the buffer

2004-10-24 Thread Flemming Greve Skovengaard
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

Re: Need Help

2004-10-07 Thread Flemming Greve Skovengaard
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

Re: How to access first key of "Hash of Hash"

2004-09-29 Thread Flemming Greve Skovengaard
$_\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

Re: qx{} and ping problem.

2004-09-09 Thread Flemming Greve Skovengaard
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. --

Re: Using reference or throw valuables to sub ?

2004-09-08 Thread Flemming Greve Skovengaard
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

Re: A regex problem.

2004-09-06 Thread Flemming Greve Skovengaard
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

Re: date format

2004-08-16 Thread Flemming Greve Skovengaard
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.

Re: date format

2004-08-16 Thread Flemming Greve Skovengaard
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

Re: date format

2004-08-16 Thread 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

GD make test fails

2004-08-13 Thread Flemming Greve Skovengaard
-- 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

Re: Perl Core

2004-07-31 Thread Flemming Greve Skovengaard
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

Re: howto 'cat file|grep "foo bar"|wc -l' in perl

2004-07-30 Thread Flemming Greve Skovengaard
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

Re: setting the environment variables in perl

2004-07-27 Thread Flemming Greve Skovengaard
$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 =>

Re: Returning variables from sub routines.

2004-07-23 Thread Flemming Greve Skovengaard
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

Re: Reading a PDF file using PERL in UNIX

2004-07-23 Thread Flemming Greve Skovengaard
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

Re: (repost) how can i generate 10 unique (non repeating) numbers

2004-07-22 Thread Flemming Greve Skovengaard
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

Re: Dot not string cat?

2004-07-22 Thread Flemming Greve Skovengaard
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]>

Re: question about strict

2004-07-21 Thread Flemming Greve Skovengaard
#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

Re: using tr

2004-07-07 Thread Flemming Greve Skovengaard
-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

Re: how does this work

2004-05-06 Thread Flemming Greve Skovengaard
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

Re: how does this work

2004-05-06 Thread Flemming Greve Skovengaard
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

Re: how does this work

2004-05-06 Thread Flemming Greve Skovengaard
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

Re: Getting into programming with perl.

2004-04-08 Thread Flemming Greve Skovengaard
. 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

Re: directory operations

2004-04-01 Thread Flemming Greve Skovengaard
: 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

Re: string change problem

2004-03-29 Thread Flemming Greve Skovengaard
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,

Re: sort function?

2004-03-25 Thread Flemming Greve Skovengaard
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

Re: Problem recording the first digits into a scalar

2004-03-09 Thread Flemming Greve Skovengaard
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,

Re: Problem recording the first digits into a scalar

2004-03-09 Thread Flemming Greve Skovengaard
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