Re: Perl Script runs to slow

2008-06-30 Thread icarus
On Jun 30, 8:01 am, [EMAIL PROTECTED] (Cheez) wrote:
> Howdy, scripting with perl is a hobby and not a vocation so i
> apologize in advance for rough looking code.
>
> I have a very large list of 16-letter words called
> "hashsequence16.txt".  This file is 203MB in size.
>
> I have a large list of data called "newrawdata.txt".  This file is
> 95MB.
>
> For each 16-letter word, I am looping through "newrawdata.txt" to 1)
> find a match and 2) take the the full line of rawdata.txt and
> associate that with the 16-letter word.
>
> Using a filesize line-counter and timing how long it takes to process
> my data lets me know that I have 9534 hours to see if I can find an
> alternative solution.  It's pretty brute force but I don't know if
> there is another way to do it.
>
> Any comments or guidance would be greatly appreciated.
>
> Thanks,
> Dan
> ==
>
> print "**fisher**";
>
> $flatfile = "newrawdata.txt";
> # 95MB in size
>
> $datafile = "hashsequence16.txt";
> # 203MB in size
>
> my $filesize = -s "hashsequence16.txt";
> # for use in processing time calculation
>
> open(FILE, "$flatfile") || die "Can't open '$flatfile': $!\n";
> open(FILE2, "$datafile") || die "Can't open '$flatfile': $!\n";
> open (SEQFILE, ">fishersearch.txt") || die "Can't open '$seqparsed': $!
> \n";
>
> @preparse = ;
> @hashdata = ;
>
> close(FILE);
> close(FILE2);
>
> for my $list1 (@hashdata) {
> # iterating through hash16 data
>
> $finish++;
>
> if ($finish ==10 ) {
> # line counter
>
> $marker = $marker + $finish;
>
> $finish =0;
>
> $left = $filesize - $marker;
>
> printf "$left\/$filesize\n";
> # this prints every 17 seconds
> }
>
> ($line, $freq) = split(/\t/, $list1);
>
> for my $rawdata (@preparse) {
> # iterating through rawdata
>
> $rawdata=~ s/\n//;
>
> if ($rawdata =~ m/$line/) {
> # matching hash16 word with rawdata line
>
> my $first_pos = index  $rawdata,$line;
>
> print SEQFILE "$first_pos\t$rawdata\n";
> # printing to info to new file
>
> }
>
> }
>
> print SEQFILE "PROCESS\t$line\n";
> # printing hash16 word and "process"
>
> }



Hi there, let me see if I can help you...

always include these two...it helps on debugging, etc..

use strict;
use warnings;


> @preparse = ;
> @hashdata = ;
   Maybe that's why your program runs so slow.
You are slurping big files into an array.

try something like ...

my $temp_file = "temp.txt";
open ($temp_file_fh, "<", $temp_file) or die $!;

while (<$temp_file_fh>){
s/[\r\n]+//; #Remove carriage returns and new lines
 if ($_ =~ m//){
   print "found\n";
  }
 }

see what I mean? use slurping with really really small files. Even so.

> For each 16-letter word, I am looping through "newrawdata.txt" to 1)
> find a match and 2) take the the full line of rawdata.txt and
> associate that with the 16-letter word.

I'd just find whatever I'm looking for on both files, push values into
an array or external file.
then I'll create a hash to associate both entries.

Try below...

for example: file 1..want to find apples.file 1 contains apples and
oranges and bananas
#!/usr/bin/perl
use strict;
use warnings;

my $ca_dir_path = "ca_files";
my $ca_log_path = "log_ca.txt";
my @ca_iea_values;
my %log_ca;


opendir (CADIR, $ca_dir_path) or die $!;

chdir $ca_dir_path;

while (defined (my $file = readdir (CADIR))){

#skip . and .. files
next if $file =~ m#^\.\.?$#;

open (FILE, $file) or die $!;
while () {
chomp;
if ( m/^IEA\*/g ) {
my $match = $_;
push @ca_iea_values, /apples/;
$log_ca{ pop @ca_iea_values } = $file;

}
}

}

open (CA_LOG, ">$ca_log_path") or die $!;
foreach (sort { $a cmp $b } keys(%log_ca) ){
print CA_LOG "$_->$log_ca{$_}\n";
}


 file 2: also looking for apples..this one file has apples, melons,
and berries
#!/usr/bin/perl
use strict;
use warnings;


my $aa_dir_path = "aa_files";
my $aa_log_path = "log_aa.txt";

my @aa_iea_values;
my %log_aa;

opendir (AADIR, $aa_dir_path) or die $!;
chdir $aa_dir_path;

while (defined (my $file = readdir (AADIR))){

#skip . and .. files
next if $file =~ m#^\.\.?$#;

open (FILE, $file) or die $!;
while () {
chomp;
if ( m/^IEA\{/g ) {
my $match = $_;
push @aa_iea_values, /apples/;
$log_aa{ pop @aa_iea_values } = $file;

}
}

}


open (AA_LOG, ">$aa_log_path") or die $!;
foreach (sort { $a cmp $b } keys(%log_aa) ){
print AA_LOG "$_->$log_aa{$_}\n";
}


file 3 would be the actual "report" generator

#!/usr/bin/perl
use warnings;
use strict;

my $ca_log_path = "log_ca.txt";
my $aa_log_path = "log_aa.txt";


my %final_report;
my @ca_filenames

Re: looping

2008-06-30 Thread Gunnar Hjalmarsson

Jeff Peng wrote:

On Tue, Jul 1, 2008 at 11:04 AM, Akhil Srivastava <[EMAIL PROTECTED]> wrote:

Still I am not able to make it work. The problem is to read a file loop from
inside a top loop and exit the file loop when the top loop finishes.


You maybe should post the code piece to the list, we may have the
chance to help you.


He did, but to clpmisc.

http://groups.google.com/group/comp.lang.perl.misc/browse_frm/thread/ae59f586e4139eeb

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: some question about komodo4

2008-06-30 Thread wise
On Jul 1, 5:12 am, [EMAIL PROTECTED] (Tobias Eichner) wrote:
> > i use komodo4 for perl develop.
>
> > but it seems that  it can't support code auto-complete.
>
> > for example ,i input "opendir" ,it can't show the dialog about auto-
> > complete.
>
> > how can i find a perl extension forkomodo?
>
> I'm also using it and auto-complete works fine... have you checked the 
> settings (can't currently say where to look, but they are missing a bit 
> structure - you can turn on/off auto-completion for several languages. Maybe 
> it's simply disabled or set to the wrong language.
>
> Tobias.
>
>
>
> > thanks
>
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >http://learn.perl.org/
>
>       __
> Gesendet von Yahoo! Mail.
> Dem pfiffigeren Posteingang.http://de.overview.mail.yahoo.com

thanks for you help, but can you tell me how to set it?
could you tell me the detail process?


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: substitution

2008-06-30 Thread Brad Baxter
On Jun 30, 4:20 pm, [EMAIL PROTECTED] (Epanda) wrote:
> Hi,
>
> I have to do a substitution of a pattern in a text file,

So you know about perl -i, right?

>
> this pattern is a key of a hash table previously set.
>
> so I want to replace my pattern by the corresponding value of the key
> in the hash table
>
> ex :
>
> file :   n1 n22
>
> hash :   n1 => wordA
> n2 => wordB
> n22 => wordN
>
> I want to have filenew like this :
>
> file :  wordA wordN
>
> with a single %s/pattern/hashpattern/g  expression
>
> Thanks for helping

You mean like this?

perl -i.bak -pe '%h = (n1=>wordA, n22=>wordN); for $x (keys %h){ s/\Q
$x/$h{$x}/g }' data.txt

--
Brad


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: looping

2008-06-30 Thread Jeff Peng
On Tue, Jul 1, 2008 at 11:04 AM, Akhil Srivastava <[EMAIL PROTECTED]> wrote:
> Still I am not able to make it work. The problem is to read a file loop from
> inside a top loop and exit the file loop when the top loop finishes.

You maybe should post the code piece to the list, we may have the
chance to help you.


-- 
Regards,
Jeff. - [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Perl Script runs to slow

2008-06-30 Thread Rob Dixon
Cheez wrote:
> Howdy, scripting with perl is a hobby and not a vocation so i
> apologize in advance for rough looking code.
> 
> I have a very large list of 16-letter words called
> "hashsequence16.txt".  This file is 203MB in size.
> 
> I have a large list of data called "newrawdata.txt".  This file is
> 95MB.
> 
> For each 16-letter word, I am looping through "newrawdata.txt" to 1)
> find a match and 2) take the the full line of rawdata.txt and
> associate that with the 16-letter word.
> 
> Using a filesize line-counter and timing how long it takes to process
> my data lets me know that I have 9534 hours to see if I can find an
> alternative solution.  It's pretty brute force but I don't know if
> there is another way to do it.
> 
> Any comments or guidance would be greatly appreciated.
> 
> Thanks,
> Dan
> ==
> 
> print "**fisher**";
> 
> $flatfile = "newrawdata.txt";
> # 95MB in size
> 
> $datafile = "hashsequence16.txt";
> # 203MB in size
> 
> my $filesize = -s "hashsequence16.txt";
> # for use in processing time calculation
> 
> open(FILE, "$flatfile") || die "Can't open '$flatfile': $!\n";
> open(FILE2, "$datafile") || die "Can't open '$flatfile': $!\n";
> open (SEQFILE, ">fishersearch.txt") || die "Can't open '$seqparsed': $!
> \n";
> 
> @preparse = ;
> @hashdata = ;
> 
> close(FILE);
> close(FILE2);
> 
> 
> for my $list1 (@hashdata) {
> # iterating through hash16 data
> 
> $finish++;
> 
> if ($finish ==10 ) {
> # line counter
> 
>   $marker = $marker + $finish;
> 
>   $finish =0;
> 
>   $left = $filesize - $marker;
> 
>   printf "$left\/$filesize\n";
> # this prints every 17 seconds
>   }
> 
> ($line, $freq) = split(/\t/, $list1);
> 
> for my $rawdata (@preparse) {
> # iterating through rawdata
> 
>   $rawdata=~ s/\n//;
> 
>   if ($rawdata =~ m/$line/) {
> # matching hash16 word with rawdata line
> 
>   my $first_pos = index  $rawdata,$line;
> 
>   print SEQFILE "$first_pos\t$rawdata\n";
> # printing to info to new file
> 
>   }
> 
>   }
> 
> print SEQFILE "PROCESS\t$line\n";
> # printing hash16 word and "process"
> 
> }

First of all it would help a lot if you added

  use strict;
  use warnings;

to the top of your program and declared everything with 'my'. For some reason
you've declared $first_pos but used the package variables for everything else.
Also you've used $seqparsed in your open error message but it's not assigned
anywhere. The strict pragma would have picked that up.

There's a problem with your progress arithmetic. You're subtracting the number
of lines read from the total file size in bytes which doesn't make sense.

The best way to speed things up is to avoid repeating operations wherever
possible. First of all you're splitting the records in the hash data file over
and over again. If you're only interested in the first field (before the tab)
then discard the rest before you enter the loop. The same applies to the records
from the other file from which you're trimming the newline many times. Do this
once before the loop.

There's also a waste when you first use a regex to locate the substring and then
do it again using index(). Using the result of the regex will potentially halve
your execution time. There's also some mileage to be gained from only compiling
the regex once before you match it against each of the data lines.

The program below should be a lot faster. Whether it is fast enough for you is
another matter, but please come back to us if you need more help. beware that
it's been tested only superficially so may need more work.

HTH,

Rob



use strict;
use warnings;

my $flatfile = 'newrawdata.txt';
my $datafile = 'hashsequence16.txt';
my $seqparsed = 'fishersearch.txt';

my @preparse = do {
  open my $fh, '<', $flatfile or die "Can't open '$flatfile': $!";
  <$fh>;
};
chomp @preparse;

my @hashdata;
{
  open my $fh, '<', $datafile or die "Can't open '$datafile': $!";
  while (<$fh>) {
my ($line) = split;
push @hashdata, $line;
  }
}

open my $seqfile, '>', $seqparsed or die "Can't open '$seqparsed': $!";

foreach my $line (@hashdata) {

  my $re = qr/\Q$line/;
  my $linelen = length $line;

  foreach my $rawdata (@preparse) {

if ($rawdata =~ /$re/g) {
  my $first_pos = pos($rawdata) - $linelen;
  print $seqfile "$first_pos\t$rawdata\n";
}
  }

  print $seqfile "PROCESS\t$line\n";
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Perl Script runs to slow

2008-06-30 Thread John W. Krahn

Cheez wrote:

Howdy,


Hello,


scripting with perl is a hobby and not a vocation so i
apologize in advance for rough looking code.

I have a very large list of 16-letter words called
"hashsequence16.txt".  This file is 203MB in size.

I have a large list of data called "newrawdata.txt".  This file is
95MB.

For each 16-letter word, I am looping through "newrawdata.txt" to 1)
find a match and 2) take the the full line of rawdata.txt and
associate that with the 16-letter word.

Using a filesize line-counter and timing how long it takes to process
my data lets me know that I have 9534 hours to see if I can find an
alternative solution.  It's pretty brute force but I don't know if
there is another way to do it.

Any comments or guidance would be greatly appreciated.

Thanks,
Dan
==


use warnings;
use strict;


print "**fisher**";

$flatfile = "newrawdata.txt";


my $flatfile = 'newrawdata.txt';


# 95MB in size

$datafile = "hashsequence16.txt";


my $datafile = 'hashsequence16.txt';


# 203MB in size


my $seqparsed = 'fishersearch.txt';



my $filesize = -s "hashsequence16.txt";


You already have the string "hashsequence16.txt" stored in the variable 
$datafile so why not use that instead:


my $filesize = -s $datafile;



# for use in processing time calculation

open(FILE, "$flatfile") || die "Can't open '$flatfile': $!\n";
open(FILE2, "$datafile") || die "Can't open '$flatfile': $!\n";


perldoc -q "What.s wrong with always quoting ..vars."

Your error message for $datafile says it couldn't open $flatfile!


open (SEQFILE, ">fishersearch.txt") || die "Can't open '$seqparsed': $!
\n";


Modern Perl idiom is to use a lexical filehandle, three argument open 
and the lower precedence 'or' operator:


open my $FILE,'<', $flatfile  or die "Can't open '$flatfile': $!\n";
open my $FILE2,   '<', $datafile  or die "Can't open '$datafile': $!\n";
open my $SEQFILE, '>', $seqparsed or die "Can't open '$seqparsed': $!\n";



@preparse = ;


Since you are going to be removing the newlines anyway:

chomp( my @preparse =  );



@hashdata = ;


It looks like you don't really need to store this whole file in memory.



close(FILE);
close(FILE2);


for my $list1 (@hashdata) {


You could probably just read through this file normally:

while ( my $list1 =  ) {



# iterating through hash16 data

$finish++;


And if you use a while loop you can use $. to get the current line number.



if ($finish ==10 ) {
# line counter

$marker = $marker + $finish;

$finish =0;

$left = $filesize - $marker;


$marker is based on the line number and $filesize is based on the number 
of bytes in the file so this calculation makes no sense.  Perhaps you 
want this instead:


# outside the loop declare $left
my $left = $filesize;

# then here in the loop

$left -= length $list1;



printf "$left\/$filesize\n";


printf() treats its first argument as a format string so that should be 
either:


printf "%s/%s\n", $left, $filesize;

Or just:

print "$left/$filesize\n";



# this prints every 17 seconds
}

($line, $freq) = split(/\t/, $list1);


You never use $freq anywhere so just:

  my ( $line ) = split /\t/, $list1;



for my $rawdata (@preparse) {
# iterating through rawdata

$rawdata=~ s/\n//;

if ($rawdata =~ m/$line/) {
# matching hash16 word with rawdata line

my $first_pos = index  $rawdata,$line;


You could combine the last two statements:

if ( ( my $first_pos = index $rawdata, $line ) >= 0 ) {



print SEQFILE "$first_pos\t$rawdata\n";
# printing to info to new file

}
}

print SEQFILE "PROCESS\t$line\n";
# printing hash16 word and "process"

}



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.-- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: substitution

2008-06-30 Thread Rob Dixon
epanda wrote:
> 
> I have to do a substitution of a pattern in a text file,
> 
> this pattern is a key of a hash table previously set.
> 
> 
> so I want to replace my pattern by the corresponding value of the key
> in the hash table
> 
> 
> ex :
> 
> file :   n1 n22
> 
> hash :   n1 => wordA
> n2 => wordB
> n22 => wordN
> 
> I want to have filenew like this :
> 
> file :  wordA wordN
> 
> 
> 
> 
> with a single %s/pattern/hashpattern/g  expression

Something like this maybe?

HTH,

Rob


use strict;
use warnings;

my $str = 'n1 n22';

my %hash = (
  n1  => 'wordA',
  n2  => 'wordB',
  n22 => 'wordN',
);


my $re = join '|', keys %hash;
$re = qr/\b(?:$re)\b/o;

$str =~ s/($re)/$hash{$1}/g;
print $str;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Array problem

2008-06-30 Thread Gunnar Hjalmarsson

Beyza wrote:

I have an array which has strings like;

John's House
Bla bla;
etc,

When I use them in an SQL query, perl gives an error. So, I need to
put escape character for every special character. Is there any quick
way to do it?


perldoc -f quotemeta

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: regexp behin assertions ?

2008-06-30 Thread Gunnar Hjalmarsson

epanda wrote:

I would like to identify in a pattern a number wich is not

preceded by another numbera word or a ';'
followed
by   ;number
~  ;\d+

I have tried this  s/\d+(?

You probably want to reverse the order.

/(?http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Array problem

2008-06-30 Thread Rob Dixon
Beyza wrote:
> Hi,
> 
> I would like to know how to insert escape character in front of
> special characters in an array.
> 
> I have an array which has strings like;
> 
> John's House
> Bla bla;
> etc,
> 
> When I use them in an SQL query, perl gives an error. So, I need to
> put escape character for every special character. Is there any quick
> way to do it?

Show us the code you are using and what error you are getting. There are many
possible solutions to this depending on exactly what you are trying to achieve.

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Perl Script runs to slow

2008-06-30 Thread Cheez
Howdy, scripting with perl is a hobby and not a vocation so i
apologize in advance for rough looking code.

I have a very large list of 16-letter words called
"hashsequence16.txt".  This file is 203MB in size.

I have a large list of data called "newrawdata.txt".  This file is
95MB.

For each 16-letter word, I am looping through "newrawdata.txt" to 1)
find a match and 2) take the the full line of rawdata.txt and
associate that with the 16-letter word.

Using a filesize line-counter and timing how long it takes to process
my data lets me know that I have 9534 hours to see if I can find an
alternative solution.  It's pretty brute force but I don't know if
there is another way to do it.

Any comments or guidance would be greatly appreciated.

Thanks,
Dan
==

print "**fisher**";

$flatfile = "newrawdata.txt";
# 95MB in size

$datafile = "hashsequence16.txt";
# 203MB in size

my $filesize = -s "hashsequence16.txt";
# for use in processing time calculation

open(FILE, "$flatfile") || die "Can't open '$flatfile': $!\n";
open(FILE2, "$datafile") || die "Can't open '$flatfile': $!\n";
open (SEQFILE, ">fishersearch.txt") || die "Can't open '$seqparsed': $!
\n";

@preparse = ;
@hashdata = ;

close(FILE);
close(FILE2);


for my $list1 (@hashdata) {
# iterating through hash16 data

$finish++;

if ($finish ==10 ) {
# line counter

$marker = $marker + $finish;

$finish =0;

$left = $filesize - $marker;

printf "$left\/$filesize\n";
# this prints every 17 seconds
}

($line, $freq) = split(/\t/, $list1);

for my $rawdata (@preparse) {
# iterating through rawdata

$rawdata=~ s/\n//;

if ($rawdata =~ m/$line/) {
# matching hash16 word with rawdata line

my $first_pos = index  $rawdata,$line;

print SEQFILE "$first_pos\t$rawdata\n";
# printing to info to new file

}

}

print SEQFILE "PROCESS\t$line\n";
# printing hash16 word and "process"

}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




regexp behin assertions ?

2008-06-30 Thread epanda
Hi,

I would like to identify in a pattern a number wich is not

preceded by another numbera word or a ';'
followed
by   ;number
~  ;\d+


I have tried this  s/\d+(?http://learn.perl.org/




Re: Array problem

2008-06-30 Thread Aruna Goke

Beyza wrote:

Hi,

I would like to know how to insert escape character in front of
special characters in an array.

I have an array which has strings like;

John's House
Bla bla;
etc,

When I use them in an SQL query, perl gives an error. So, I need to
put escape character for every special character. Is there any quick
way to do it?

Thanks from now on,



consider using placeholder in your query.

goksie

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: about perl module uninstallation

2008-06-30 Thread Telemachus
On Jun 22, 3:32 pm, [EMAIL PROTECTED] (Randal L. Schwartz) wrote:
> Note: the CPAN Shell and the CPAN-PLUS Shell are not package managers, and
> have no uninstall capability.

Cpan-plus can uninstall, but only if you installed the module with
cpan-plus originally. I thought that was one of the main benefits of
cpanp over cpan (the command not the CPAN).

Not that this necessarily helps here.

@ Rajnikant - How did you install them and why do you need to remove
them?


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: AW: AW: accessing imap servers using perl script - LOGIN FAILURE: access denied"

2008-06-30 Thread Aruna Goke

Tobias Eichner wrote:

what is smtp from what i raised so far?

I need an imap access to the server not smtp.


Sorry, I meant IMAP, my mistake. Anyway, solution could be the same... to 
exclude problems with your source code, try an alternative server that is 
working for sure.

Tobias.




Thanks

Goksie




  __
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com


Tobias,

you need to read my mail again.

the quote from my original mail ---

"when i run the script below am getting "LOGIN FAILURE: access denied", 
if I login with Net::IMAP::Simple and my username and password is 
correct. However, If I run same script on my local server, its working 
okay."


thanks for your time.

Goksie

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Array problem

2008-06-30 Thread Beyza
Hi,

I would like to know how to insert escape character in front of
special characters in an array.

I have an array which has strings like;

John's House
Bla bla;
etc,

When I use them in an SQL query, perl gives an error. So, I need to
put escape character for every special character. Is there any quick
way to do it?

Thanks from now on,


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Check if directory is empty on Win32

2008-06-30 Thread Rob Dixon
Leonid L wrote:
> On Jun 27, 1:52 pm, [EMAIL PROTECTED] (Paul Lalli) wrote:
>> On Jun 26, 5:50 pm, [EMAIL PROTECTED] (Leonid L) wrote:
>>
>>> Many of the proposed solutions I've found on Google do not work for
>>> me, perhaps because they assume Unix/Linux host.
>> Or, perhaps because you're doing something wrong?   How about posting
>> one of these methods that "don't work", so we can evaluate for
>> ourselves?
>>
>>>  I need a sub that
>>> will reliably tell me whether a given directory isempty(I am running
>>> Perl on Win XP, NTFS file system). Please give your implementation a
>>> quick test on a similar platform before posting.
>> There's a couple hundred ways.  Here's two:
>>
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>>
>> mkdir("working_dir") or die "Cannot create working_dir: $!";
>> chdir("working_dir") or die "Cannot change to working_dir: $!";
>>
>> mkdir("empty") or die "Can't createempty: $!";
>> mkdir("subdir") or die "Can't create subdir: $!";
>> mkdir("subdir/foo") or die "Can't create subdir/foo: $!";
>> mkdir("file") or die "Can't create file: $!";
>> open my $ofh, '>', "file/bar" or die "Can't create file/bar: $!";
>> close $ofh;
>> mkdir("dotfile") or die "Can't create dotfile: $!";
>> open my $ofh2, '>', "dotfile/.baz" or die "Can't create dotfile/.baz:
>> $!"; close $ofh2;
>>
>> for my $dir(qw/emptysubdir file dotfile/) {
>> print is_empty1($dir) ? "$dirisempty\n" : "$diris notempty\n";
>> print is_empty2($dir) ? "$dirisempty\n" : "$diris notempty\n";
>>
>> }
>>
>> sub is_empty1 {
>>   my $dir= shift;
>>   my @contents = grep { ! /^$dir\/\.\.?$/ } glob("$dir/* $dir/.*");
>>   return @contents == 0;
>>
>> }
>>
>> sub is_empty2 {
>>   my $dir= shift;
>>   opendir my $dh, $diror die "Cannot open $dir: $!";
>>   my @contents = grep { ! /^\.\.?$/ } readdir($dh);
>>   return @contents == 0;}
>>
>> __END__
>>
>> Results:emptyisemptyemptyisempty
>> subdir is notempty
>> subdir is notempty
>> file is notempty
>> file is notempty
>> dotfile is notempty
>> dotfile is notempty
>>
>> This is perl, v5.10.0 built for MSWin32-x86-multi-thread
>>
>> Paul Lalli
> 
> Thank you all for your posts. The second version works better when the
> file path looks like "\\server\subDirL1\subDirl2\...".
> I find Python version a bit more readable:
> import os
> def dirEmpty(path):
> return len(os.listdir(path)) == 0
> Still, it is too bad that in either language there is no simple API
> call that would return a simple True/False answer that I am looking
> for ...

How about this?

Rob



sub dirempty {
  my $path = shift;
  listdir($path) == 0;
}

sub listdir {
  my $path = shift;
  opendir my $dh, $path or return undef;
  grep { not /^\.\.?$/ } readdir $dh;
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




substitution

2008-06-30 Thread epanda
Hi,


I have to do a substitution of a pattern in a text file,

this pattern is a key of a hash table previously set.


so I want to replace my pattern by the corresponding value of the key
in the hash table


ex :

file :   n1 n22

hash :   n1 => wordA
n2 => wordB
n22 => wordN

I want to have filenew like this :

file :  wordA wordN




with a single %s/pattern/hashpattern/g  expression

Thanks for helping


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: print reference

2008-06-30 Thread Rob Dixon
onlineviewer wrote:
> 
> Can someone tell me the proper syntax to print out the value in a
> reference?
> Thank you.,,

I'm not sure what you mean. Look:

> my $string = '';
> open my $scalar_fh, '>>', \$string;

So you have opened a file handle to append to the scalar $string.

> my $log_message = "here is my string...";
> print $scalar_fh $log_message;

And now you have printed "here is my string..." to that file handle. If you
examine the contents of $string you will see that it has worked.

Now $string eq "here is my string..." and $scalar_fh is a file handle (a glob
reference) so I don't understand what you're trying to do here.

> foreach my $fh ($scalar_fh) {
> print "$fh";
> 
> }

There is only one item in your list, $scalar_fh, so the loop is executed once,
and it is the same as

  print "$scalar_fh";

Perl tries its best to display the value of the file handle, but it's not a very
meaningful thing to do.

Do you mean just this?

  print $string, "\n";

HTH,

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: print reference

2008-06-30 Thread John W. Krahn

onlineviewer wrote:

Hello All,


Hello,


Can someone tell me the proper syntax to print out the value in a
reference?


I assume you mean how to dereference a reference?

perldoc perlref



Thank you.,,

my $string = '';
open my $scalar_fh, '>>', \$string;

my $log_message = "here is my string...";
print $scalar_fh $log_message;

foreach my $fh ($scalar_fh ) {
print "$fh";


$scalar_fh is a filehandle and you are converting it to a string. 
Perhaps you just wanted to print the contents of $string?


print $string;




}




John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.-- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Automation

2008-06-30 Thread obdulio santana
In windows there is a freeware, it's a clon for windows   I'm using it for
several months and works fine.

nncronlt111.exe  it's small and easy to use.

I found in ten minutes google searching.

if  you want it,  tell me how can I send to you.

HTH

2008/6/30 Tobias Eichner <[EMAIL PROTECTED]>:

> > Thanks for your information.
> > But here i am using Windows XP operating system
>
> Then
> have a look at the task planner application (Start -> All programs
> -> Utilities -> System programs -> Task planner). It comes
> with Win XP and should be easy to use.
>
> Tobias.
>
> (Sorry for double-posting, but Yahoo!Mail refuses to do it the way I want
> sometimes ;-)
>
>
>  __
> Gesendet von Yahoo! Mail.
> Dem pfiffigeren Posteingang.
> http://de.overview.mail.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>


AW: AW: accessing imap servers using perl script - LOGIN FAILURE: access denied"

2008-06-30 Thread Tobias Eichner

> what is smtp from what i raised so far?
> 
> I need an imap access to the server not smtp.

Sorry, I meant IMAP, my mistake. Anyway, solution could be the same... to 
exclude problems with your source code, try an alternative server that is 
working for sure.

Tobias.



> 
> Thanks
> 
> Goksie



  __
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




print reference

2008-06-30 Thread onlineviewer
Hello All,

Can someone tell me the proper syntax to print out the value in a
reference?
Thank you.,,

my $string = '';
open my $scalar_fh, '>>', \$string;

my $log_message = "here is my string...";
print $scalar_fh $log_message;

foreach my $fh ($scalar_fh ) {
print "$fh";

}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




AW: some question about komodo4

2008-06-30 Thread Tobias Eichner
> i use komodo4 for perl develop.
> 
> but it seems that  it can't support code auto-complete.
> 
> for example ,i input "opendir" ,it can't show the dialog about auto-
> complete.
> 
> how can i find a perl extension for komodo?

I'm also using it and auto-complete works fine... have you checked the settings 
(can't currently say where to look, but they are missing a bit structure - you 
can turn on/off auto-completion for several languages. Maybe it's simply 
disabled or set to the wrong language.

Tobias.



> 
> thanks
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/



  __
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: show only numbers before, within or after the text

2008-06-30 Thread Brad Baxter
On Jun 28, 11:18 am, [EMAIL PROTECTED] (Luca Villa) wrote:
> I have a long text file like this:
>
> 324yellow
> 34house
> black
> 54532
> 15m21red56
> 44dfdsf8sfd23
>
> How can I obtain (Perl - Windows/commandline/singleline) the
> following?
>
> 1) only the numbers at the beginning before some alpha text, like
> this:
>
> 324
> 34
> 15
> 44
>
> 2) only the numbers within the alpha text, like this:
>
> 21
> 8
>
> 3) only the numbers at the end after some alpha text, like this:
>
> 56
> 23

perl -F'(\D+)' -lane'$,="|";[EMAIL PROTECTED]' data.txt
324|yellow
34|house
|black
54532
15|m|21|red|56
44|dfdsf|8|sfd|23

--
Brad


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Check if directory is empty on Win32

2008-06-30 Thread Leonid L
On Jun 27, 1:52 pm, [EMAIL PROTECTED] (Paul Lalli) wrote:
> On Jun 26, 5:50 pm, [EMAIL PROTECTED] (Leonid L) wrote:
>
> > Many of the proposed solutions I've found on Google do not work for
> > me, perhaps because they assume Unix/Linux host.
>
> Or, perhaps because you're doing something wrong?   How about posting
> one of these methods that "don't work", so we can evaluate for
> ourselves?
>
> >  I need a sub that
> > will reliably tell me whether a given directory isempty(I am running
> > Perl on Win XP, NTFS file system). Please give your implementation a
> > quick test on a similar platform before posting.
>
> There's a couple hundred ways.  Here's two:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> mkdir("working_dir") or die "Cannot create working_dir: $!";
> chdir("working_dir") or die "Cannot change to working_dir: $!";
>
> mkdir("empty") or die "Can't createempty: $!";
> mkdir("subdir") or die "Can't create subdir: $!";
> mkdir("subdir/foo") or die "Can't create subdir/foo: $!";
> mkdir("file") or die "Can't create file: $!";
> open my $ofh, '>', "file/bar" or die "Can't create file/bar: $!";
> close $ofh;
> mkdir("dotfile") or die "Can't create dotfile: $!";
> open my $ofh2, '>', "dotfile/.baz" or die "Can't create dotfile/.baz:
> $!"; close $ofh2;
>
> for my $dir(qw/emptysubdir file dotfile/) {
> print is_empty1($dir) ? "$dirisempty\n" : "$diris notempty\n";
> print is_empty2($dir) ? "$dirisempty\n" : "$diris notempty\n";
>
> }
>
> sub is_empty1 {
>   my $dir= shift;
>   my @contents = grep { ! /^$dir\/\.\.?$/ } glob("$dir/* $dir/.*");
>   return @contents == 0;
>
> }
>
> sub is_empty2 {
>   my $dir= shift;
>   opendir my $dh, $diror die "Cannot open $dir: $!";
>   my @contents = grep { ! /^\.\.?$/ } readdir($dh);
>   return @contents == 0;}
>
> __END__
>
> Results:emptyisemptyemptyisempty
> subdir is notempty
> subdir is notempty
> file is notempty
> file is notempty
> dotfile is notempty
> dotfile is notempty
>
> This is perl, v5.10.0 built for MSWin32-x86-multi-thread
>
> Paul Lalli

Thank you all for your posts. The second version works better when the
file path looks like "\\server\subDirL1\subDirl2\...".
I find Python version a bit more readable:
import os
def dirEmpty(path):
return len(os.listdir(path)) == 0
Still, it is too bad that in either language there is no simple API
call that would return a simple True/False answer that I am looking
for ...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




some question about komodo4

2008-06-30 Thread wise
i use komodo4 for perl develop.

but it seems that  it can't support code auto-complete.

for example ,i input "opendir" ,it can't show the dialog about auto-
complete.

how can i find a perl extension for komodo?

thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: How can I translate it back to @ sign.

2008-06-30 Thread Aruna Goke

Amit Saxena wrote:

Hi Aruna

The solution


my $invexcl = "\x{00A1}";
   my $atsign = "\x{0040}";
$mailreci =~ s/(\w+)$invexcl(\w+)/$1$atsign$2/g;

works fine.

However that assumes that you know the control character to be substituted.

If the file contains lots of control characters and if the requirement 
is to remove all of them or to
substitute all of them with some ascii character etc, my solution is 
preferred.


By the way, how do you find the octal / hexadecimal code of control 
character that appears in the file.


I use UNIX "ob -bc" command for the same but even that is also 
cumbersome if there are many lines

and many control charcters.

Regards,
Amit Saxena


On Mon, Jun 30, 2008 at 7:05 PM, Aruna Goke <[EMAIL PROTECTED] 
> wrote:


Amit Saxena wrote:

Try

$email =~ s/[[:cntrl:]]/@/g;

instead of

$email =~ s/!/@/g;

Infact try this in the entire file.

Note :- This is on the assumption that there are no other
control characters in the input file.

On Fri, Jun 27, 2008 at 2:51 AM, Aruna Goke <[EMAIL PROTECTED]
 >> wrote:

   David Romero wrote:

   use a regular expression

   my $email = 'user!dominio.com 
';
   $email =~ s/!/@/g;
   ###Result [EMAIL PROTECTED] 
>


   http://www.troubleshooters.com/codecorn/littperl/perlreg.htm


   On Thu, Jun 26, 2008 at 1:35 PM, Aruna Goke
<[EMAIL PROTECTED] 
   >> wrote:

   hi,

   i have the this log from my sms gateway, however, the
   inverted exclamation
   mark was sent from the smsc as @.

   2008-06-26 17:22:35 SMS request sender:+2342019122
request:
   'maruna¡ontng.com 
,test,Love my test

   message' file answer: ''
   2008-06-26 17:27:17 Receive SMS [SMSC:caxt] [SVC:] [ACT:]
   [BINF:]
   [from:+2342019122] [to:+2349191] [flags:-1:0:-1:0:-1]
   [msg:43:maruna!ontng.com 
,test,Love my

   test message] [udh:0:]
   2008-06-26 17:27:17 SMS request sender:+23422019122
request:
   'maruna!ontng.com 
,test,'Love my test

   message'file answer: ''
   2008-06-26 17:34:15 Receive SMS [SMSC:caxt] [SVC:] [ACT:]
   [BINF:]
   [from:+2342019122] [to:+2349191] [flags:-1:0:-1:0:-1]
   [msg:43:maruna¡ontng.com 
,test,Love my

   test message] [udh:0:]

   I have my script that parse the file and extract as below

   To: maruna¡ontng.com 
 Subject: test

   Message: Love my test message  sender :
   [EMAIL PROTECTED] 
>



   What i want to achieve is to translate the to address
back to
   [EMAIL PROTECTED] 
> instaed of
   maruna¡ontng.com  .


   when i checked through, i discover that it is inverted
   exclamation mark with
   character code 00A1 from unicode(hex) of latin-1
subset. I
   need this
   translated to @, any help will be appreciated


   my script is as below

   #!/usr/bin/perl

   use strict;
   use warnings;
   use File::Tail;
   use Mail::Sender;


   # the access.log is read and the following, recepient is
   extracted.

   my $name = "/var/log/bulksms/sms_access.log";
   my ($mailreci, $mailsubj, @sms, $mailmsg, $mailsend,
   $sendee, $sender, $msg,
   $domain);
   $domain = 'ontng.com 
';

   open my $file, '<', $name or die "could not open
$name: $!";
   $file=File::Tail->new(name=>$name, maxinterval=>3,
   adjustafter=>5);
   while (defined($_=$file->read)

Re: AW: accessing imap servers using perl script - LOGIN FAILURE: access denied"

2008-06-30 Thread Aruna Goke

Tobias Eichner wrote:

Connecting to imap.mail.yahoo.com port 143
Connected to imap.mail.yahoo.com

...

my $imapserver = 'imap.mail.yahoo.com';
my $user = 'testkingonet';
my $pass = '123456';


May it possible that Yahoo's SMTP server detects that it is being used by a 
script instead of by a mail client and therefore refuses to work ? Have you 
tried an alternative SMTP server ?

Tobias.


  __
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com



Tobias,

what is smtp from what i raised so far?

I need an imap access to the server not smtp.

Thanks

Goksie

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




AW: accessing imap servers using perl script - LOGIN FAILURE: access denied"

2008-06-30 Thread Tobias Eichner
> Connecting to imap.mail.yahoo.com port 143
> Connected to imap.mail.yahoo.com
...
> my $imapserver = 'imap.mail.yahoo.com';
> my $user = 'testkingonet';
> my $pass = '123456';

May it possible that Yahoo's SMTP server detects that it is being used by a 
script instead of by a mail client and therefore refuses to work ? Have you 
tried an alternative SMTP server ?

Tobias.


  __
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




AW: Automation

2008-06-30 Thread Tobias Eichner
> Thanks for your information.
> But here i am using Windows XP operating system

Then
have a look at the task planner application (Start -> All programs
-> Utilities -> System programs -> Task planner). It comes
with Win XP and should be easy to use.

Tobias.

(Sorry for double-posting, but Yahoo!Mail refuses to do it the way I want 
sometimes ;-)


  __
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: How can I translate it back to @ sign.

2008-06-30 Thread Amit Saxena
Hi Aruna

The solution


my $invexcl = "\x{00A1}";
   my $atsign = "\x{0040}";
$mailreci =~ s/(\w+)$invexcl(\w+)/$1$atsign$2/g;

works fine.

However that assumes that you know the control character to be substituted.

If the file contains lots of control characters and if the requirement is to
remove all of them or to
substitute all of them with some ascii character etc, my solution is
preferred.

By the way, how do you find the octal / hexadecimal code of control
character that appears in the file.

I use UNIX "ob -bc" command for the same but even that is also cumbersome if
there are many lines
and many control charcters.

Regards,
Amit Saxena


On Mon, Jun 30, 2008 at 7:05 PM, Aruna Goke <[EMAIL PROTECTED]> wrote:

> Amit Saxena wrote:
>
>> Try
>>
>> $email =~ s/[[:cntrl:]]/@/g;
>>
>> instead of
>>
>> $email =~ s/!/@/g;
>>
>> Infact try this in the entire file.
>>
>> Note :- This is on the assumption that there are no other control
>> characters in the input file.
>>
>> On Fri, Jun 27, 2008 at 2:51 AM, Aruna Goke <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> wrote:
>>
>>David Romero wrote:
>>
>>use a regular expression
>>
>>my $email = 'user!dominio.com ';
>>$email =~ s/!/@/g;
>>###Result [EMAIL PROTECTED] 
>>
>>http://www.troubleshooters.com/codecorn/littperl/perlreg.htm
>>
>>
>>On Thu, Jun 26, 2008 at 1:35 PM, Aruna Goke <[EMAIL PROTECTED]
>>> wrote:
>>
>>hi,
>>
>>i have the this log from my sms gateway, however, the
>>inverted exclamation
>>mark was sent from the smsc as @.
>>
>>2008-06-26 17:22:35 SMS request sender:+2342019122 request:
>>'maruna¡ontng.com ,test,Love my test
>>message' file answer: ''
>>2008-06-26 17:27:17 Receive SMS [SMSC:caxt] [SVC:] [ACT:]
>>[BINF:]
>>[from:+2342019122] [to:+2349191] [flags:-1:0:-1:0:-1]
>>[msg:43:maruna!ontng.com ,test,Love my
>>test message] [udh:0:]
>>2008-06-26 17:27:17 SMS request sender:+23422019122 request:
>>'maruna!ontng.com ,test,'Love my test
>>message'file answer: ''
>>2008-06-26 17:34:15 Receive SMS [SMSC:caxt] [SVC:] [ACT:]
>>[BINF:]
>>[from:+2342019122] [to:+2349191] [flags:-1:0:-1:0:-1]
>>[msg:43:maruna¡ontng.com ,test,Love my
>>test message] [udh:0:]
>>
>>I have my script that parse the file and extract as below
>>
>>To: maruna¡ontng.com  Subject: test
>>Message: Love my test message  sender :
>>[EMAIL PROTECTED] 
>>
>>
>>What i want to achieve is to translate the to address back to
>>[EMAIL PROTECTED]  instaed of
>>maruna¡ontng.com .
>>
>>when i checked through, i discover that it is inverted
>>exclamation mark with
>>character code 00A1 from unicode(hex) of latin-1 subset. I
>>need this
>>translated to @, any help will be appreciated
>>
>>
>>my script is as below
>>
>>#!/usr/bin/perl
>>
>>use strict;
>>use warnings;
>>use File::Tail;
>>use Mail::Sender;
>>
>>
>># the access.log is read and the following, recepient is
>>extracted.
>>
>>my $name = "/var/log/bulksms/sms_access.log";
>>my ($mailreci, $mailsubj, @sms, $mailmsg, $mailsend,
>>$sendee, $sender, $msg,
>>$domain);
>>$domain = 'ontng.com ';
>>open my $file, '<', $name or die "could not open $name: $!";
>>$file=File::Tail->new(name=>$name, maxinterval=>3,
>>adjustafter=>5);
>>while (defined($_=$file->read))
>>  {
>>  @sms = split/\[/;
>>  next unless $sms[6]=~/to:\+2349191\]/;
>>  $sendee = $sms[5];
>>  $sendee =~ s/from:\+(\d+)\]/$1/;
>>  $sendee = "[EMAIL PROTECTED]";
>>  $msg = $sms[8];
>>  $msg = (split/:/, $msg)[-1];
>>  $msg =~ s/(\w+)\s?\]/$1/;
>>#   i need only sender and $msg
>>  ($mailreci, $mailsubj, $mailmsg) = (split/,/, $msg,
>>3)[0..2];
>>
>>  print  "To: $mailreci Subject: $mailsubj Message:
>>$mailmsg sender :
>>$sendee\n";
>>
>>   }
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>

Re: Automation

2008-06-30 Thread Amit Saxena
You can even refer to free task schedules for windows on the web. Have a
look at

http://www.snapfiles.com/freeware/

You also can go for cygwin on Windows.

On Mon, Jun 30, 2008 at 8:18 PM, Bob McConnell <[EMAIL PROTECTED]> wrote:

> In MS-Windows, take a look at the Task Scheduler to see if it can help.
>
>  Start->Programs->Accessories->System Tools->Scheduled Tasks
>
> Bob McConnell
>
> -Original Message-
> From: Ram [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 30, 2008 5:03 AM
> To: beginners@perl.org
> Subject: Re: Automation
>
> Thanks for your information.
> But here i am using Windows XP operating system
>
> Thanks,
> Ram
>
> On Jun 30, 12:57 pm, [EMAIL PROTECTED] (Eko Budiharto) wrote:
> > you can use crontab in linux.
> >
> >
> >
> >
> >
> > On Mon, Jun 30, 2008 at 2:26 PM, Ram <[EMAIL PROTECTED]> wrote:
> > > Hi All,
> >
> > > I am begineer to perl language. Want help for the automation of the
> > > perl script.
> > > Is it possible to run a perl script at defined time interval without
> > > cliking over the scipt and using command prompt.
> >
> > > I want it run without any GUI. it shoud run automatically at defined
> > > time ?
> >
> > > Please give your valuable suggestions
> >
> > > Thanks in advance.
> >
> > > Ram
> >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >http://learn.perl.org/
> >
> > --
> > Eko Budiharto- Hide quoted text -
> >
> > - Show quoted text -
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>


RE: Automation

2008-06-30 Thread Bob McConnell
In MS-Windows, take a look at the Task Scheduler to see if it can help.

  Start->Programs->Accessories->System Tools->Scheduled Tasks

Bob McConnell

-Original Message-
From: Ram [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 30, 2008 5:03 AM
To: beginners@perl.org
Subject: Re: Automation

Thanks for your information.
But here i am using Windows XP operating system

Thanks,
Ram

On Jun 30, 12:57 pm, [EMAIL PROTECTED] (Eko Budiharto) wrote:
> you can use crontab in linux.
>
>
>
>
>
> On Mon, Jun 30, 2008 at 2:26 PM, Ram <[EMAIL PROTECTED]> wrote:
> > Hi All,
>
> > I am begineer to perl language. Want help for the automation of the
> > perl script.
> > Is it possible to run a perl script at defined time interval without
> > cliking over the scipt and using command prompt.
>
> > I want it run without any GUI. it shoud run automatically at defined
> > time ?
>
> > Please give your valuable suggestions
>
> > Thanks in advance.
>
> > Ram
>
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >http://learn.perl.org/
>
> --
> Eko Budiharto- Hide quoted text -
>
> - Show quoted text -


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




accessing imap servers using perl script - LOGIN FAILURE: access denied"

2008-06-30 Thread Aruna Goke
when i run the script below am getting "LOGIN FAILURE: access denied", 
if I login with Net::IMAP::Simple and my username and password is 
correct. However, If I run same script on my local server, its working okay.


If I use the Mail::IMAPClient module to  do the login.

I have the error below.

Started at Mon Jun 30 14:05:44 2008
Using Mail::IMAPClient version 3.08 on perl 5.01
Connecting to imap.mail.yahoo.com port 143
Connected to imap.mail.yahoo.com
Read: * OK IMAP4rev1 server ready (3.5.28)
Sending: 1 LOGIN "testkingonet" 123456
Sent 24 bytes
Read: 1 NO LOGIN failure. Access denied
ERROR: 1 NO LOGIN failure. Access denied
Can't call method "select" on an undefined value at 
mailfetcher-imapclien.pl line 32.



Can someone help out on this s that I can use that to access yahoo and 
hotmail, gmail etc etc with the script.


Goksie

#!/usr/bin/perl

#mailfetcher.pl

use warnings;
use strict;
use diagnostics;
use Net::IMAP::Simple;
use Email::Simple;
use Mail::IMAPClient;

my $imapserver = 'imap.mail.yahoo.com';
my $user = 'testkingonet';
my $pass = '123456';

my $imap = Net::IMAP::Simple->new("$imapserver") or die "Unable to 
connect to IMAP: $Net::IMAP::Simple::errstr\n";


#If the module Mail::IMAPClient is used for login ###
#-###
#my $imap = Mail::IMAPClient->new;
#$imap = Mail::IMAPClient->new(
#Server => $imapserver,
#User=> $user,
#Password=> $pass,
#Clear   => 5,   # Unnecessary since '5' is the 
#default

#Authmechanism => "CRAM-MD5",
##   ... # Other key=>value pairs go #here
#);
#if($imap->login){
#print "Success";
#} else {print "Could not login: [EMAIL PROTECTED]";}


# Log on
   if(!$imap->login("$user","$pass")){
   print STDERR "Login failed: " . $imap->errstr . "\n";
   exit(64);
}
my $inbox =~ m/inbox/i;

# Print the subject's of all the messages in the INBOX
my $nem = $imap->select("$inbox");

  my $emailsimple = Email::Simple->new(join '', @{ $imap->get($nem) });
  print $emailsimple->body;


  $imap->quit;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: I could not do it with matlab could perl do it?

2008-06-30 Thread John W. Krahn

John W. Krahn wrote:

Amit Saxena wrote:


On Wed, Jun 25, 2008 at 1:20 PM, fadlyemen <[EMAIL PROTECTED]> wrote:


I could not do it with matlab could perl do it?
I appreciate if I have solution for this problem
I  try to extract two columns from a text file(8 columns) with
variable
number of headerlines, and variable line length.
below is one line of my data


S= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457  NA
mitotic

spindle elongation  YBL084C '

How  could I get column 4 , 5 using perl.


$str= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457  
NAmitotic

spindle elongation  YBL084C '

(undef, undef, undef, $var1, $var2) = split (/\s*/, $str);


Perl arrays and lists start at zero so that stores columns 3 and 4 *not* 
4 and 5 as the OP wants.


Sorry, please ignore that.   :-)


Using a split pattern that matches zero times 
is the same as using an empty pattern, it will split on individual 
non-whitespace characters, not columns.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.-- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Automation

2008-06-30 Thread Ram
Thanks for your information.
But here i am using Windows XP operating system

Thanks,
Ram

On Jun 30, 12:57 pm, [EMAIL PROTECTED] (Eko Budiharto) wrote:
> you can use crontab in linux.
>
>
>
>
>
> On Mon, Jun 30, 2008 at 2:26 PM, Ram <[EMAIL PROTECTED]> wrote:
> > Hi All,
>
> > I am begineer to perl language. Want help for the automation of the
> > perl script.
> > Is it possible to run a perl script at defined time interval without
> > cliking over the scipt and using command prompt.
>
> > I want it run without any GUI. it shoud run automatically at defined
> > time ?
>
> > Please give your valuable suggestions
>
> > Thanks in advance.
>
> > Ram
>
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >http://learn.perl.org/
>
> --
> Eko Budiharto- Hide quoted text -
>
> - Show quoted text -


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Automation

2008-06-30 Thread Edi Stojicevic
* Eko Budiharto <[EMAIL PROTECTED]> [2008-06-30 14:57:51 +0700] wrote :

[...]

> you can use crontab in linux.

man crontab :)

Cheers,
-- 
. ''`.  (\___/) E d i   S T O J I C E V I C
: :'  : (='.'=) http://www.debianworld.org 
`. `~'  (")_(") GPG: 0x1237B032
  `-

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: I could not do it with matlab could perl do it?

2008-06-30 Thread John W. Krahn

Amit Saxena wrote:


On Wed, Jun 25, 2008 at 1:20 PM, fadlyemen <[EMAIL PROTECTED]> wrote:


I could not do it with matlab could perl do it?
I appreciate if I have solution for this problem
I  try to extract two columns from a text file(8 columns) with
variable
number of headerlines, and variable line length.
below is one line of my data


S= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457  NA
mitotic

spindle elongation  YBL084C '

How  could I get column 4 , 5 using perl.


$str= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457  NAmitotic
spindle elongation  YBL084C '

(undef, undef, undef, $var1, $var2) = split (/\s*/, $str);


Perl arrays and lists start at zero so that stores columns 3 and 4 *not* 
4 and 5 as the OP wants.  Using a split pattern that matches zero times 
is the same as using an empty pattern, it will split on individual 
non-whitespace characters, not columns.




John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.-- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: How can I translate it back to @ sign.

2008-06-30 Thread Aruna Goke

Amit Saxena wrote:

Try

$email =~ s/[[:cntrl:]]/@/g;

instead of

$email =~ s/!/@/g;

Infact try this in the entire file.

Note :- This is on the assumption that there are no other control 
characters in the input file.


On Fri, Jun 27, 2008 at 2:51 AM, Aruna Goke <[EMAIL PROTECTED] 
> wrote:


David Romero wrote:

use a regular expression

my $email = 'user!dominio.com ';
$email =~ s/!/@/g;
###Result [EMAIL PROTECTED] 

http://www.troubleshooters.com/codecorn/littperl/perlreg.htm


On Thu, Jun 26, 2008 at 1:35 PM, Aruna Goke <[EMAIL PROTECTED]
> wrote:

hi,

i have the this log from my sms gateway, however, the
inverted exclamation
mark was sent from the smsc as @.

2008-06-26 17:22:35 SMS request sender:+2342019122 request:
'maruna¡ontng.com ,test,Love my test
message' file answer: ''
2008-06-26 17:27:17 Receive SMS [SMSC:caxt] [SVC:] [ACT:]
[BINF:]
[from:+2342019122] [to:+2349191] [flags:-1:0:-1:0:-1]
[msg:43:maruna!ontng.com ,test,Love my
test message] [udh:0:]
2008-06-26 17:27:17 SMS request sender:+23422019122 request:
'maruna!ontng.com ,test,'Love my test
message'file answer: ''
2008-06-26 17:34:15 Receive SMS [SMSC:caxt] [SVC:] [ACT:]
[BINF:]
[from:+2342019122] [to:+2349191] [flags:-1:0:-1:0:-1]
[msg:43:maruna¡ontng.com ,test,Love my
test message] [udh:0:]

I have my script that parse the file and extract as below

To: maruna¡ontng.com  Subject: test
Message: Love my test message  sender :
[EMAIL PROTECTED] 


What i want to achieve is to translate the to address back to
[EMAIL PROTECTED]  instaed of
maruna¡ontng.com .

when i checked through, i discover that it is inverted
exclamation mark with
character code 00A1 from unicode(hex) of latin-1 subset. I
need this
translated to @, any help will be appreciated


my script is as below

#!/usr/bin/perl

use strict;
use warnings;
use File::Tail;
use Mail::Sender;


# the access.log is read and the following, recepient is
extracted.

my $name = "/var/log/bulksms/sms_access.log";
my ($mailreci, $mailsubj, @sms, $mailmsg, $mailsend,
$sendee, $sender, $msg,
$domain);
$domain = 'ontng.com ';
open my $file, '<', $name or die "could not open $name: $!";
$file=File::Tail->new(name=>$name, maxinterval=>3,
adjustafter=>5);
while (defined($_=$file->read))
  {
  @sms = split/\[/;
  next unless $sms[6]=~/to:\+2349191\]/;
  $sendee = $sms[5];
  $sendee =~ s/from:\+(\d+)\]/$1/;
  $sendee = "[EMAIL PROTECTED]";
  $msg = $sms[8];
  $msg = (split/:/, $msg)[-1];
  $msg =~ s/(\w+)\s?\]/$1/;
#   i need only sender and $msg
  ($mailreci, $mailsubj, $mailmsg) = (split/,/, $msg,
3)[0..2];

  print  "To: $mailreci Subject: $mailsubj Message:
$mailmsg sender :
$sendee\n";

   }




--
To unsubscribe, e-mail: [EMAIL PROTECTED]

For additional commands, e-mail: [EMAIL PROTECTED]

http://learn.perl.org/







its not an exclamation mark but inverted exclammation mark.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]


For additional commands, e-mail: [EMAIL PROTECTED]

http://learn.perl.org/





 my $invexcl = "\x{00A1}";
my $atsign = "\x{0040}";
 $mailreci =~ s/(\w+)$invexcl(\w+)/$1$atsign$2/g;

I have used that above code to do the conversion and it seems to work now.

Goksie



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: How can I translate it back to @ sign.

2008-06-30 Thread Amit Saxena
Try

$email =~ s/[[:cntrl:]]/@/g;

instead of

$email =~ s/!/@/g;

Infact try this in the entire file.

Note :- This is on the assumption that there are no other control characters
in the input file.

On Fri, Jun 27, 2008 at 2:51 AM, Aruna Goke <[EMAIL PROTECTED]> wrote:

> David Romero wrote:
>
>> use a regular expression
>>
>> my $email = 'user!dominio.com';
>> $email =~ s/!/@/g;
>> ###Result [EMAIL PROTECTED]
>>
>> http://www.troubleshooters.com/codecorn/littperl/perlreg.htm
>>
>>
>> On Thu, Jun 26, 2008 at 1:35 PM, Aruna Goke <[EMAIL PROTECTED]> wrote:
>>
>>> hi,
>>>
>>> i have the this log from my sms gateway, however, the inverted
>>> exclamation
>>> mark was sent from the smsc as @.
>>>
>>> 2008-06-26 17:22:35 SMS request sender:+2342019122 request:
>>> 'maruna¡ontng.com,test,Love my test message' file answer: ''
>>> 2008-06-26 17:27:17 Receive SMS [SMSC:caxt] [SVC:] [ACT:] [BINF:]
>>> [from:+2342019122] [to:+2349191] [flags:-1:0:-1:0:-1]
>>> [msg:43:maruna!ontng.com,test,Love my test message] [udh:0:]
>>> 2008-06-26 17:27:17 SMS request sender:+23422019122 request:
>>> 'maruna!ontng.com,test,'Love my test message'file answer: ''
>>> 2008-06-26 17:34:15 Receive SMS [SMSC:caxt] [SVC:] [ACT:] [BINF:]
>>> [from:+2342019122] [to:+2349191] [flags:-1:0:-1:0:-1]
>>> [msg:43:maruna¡ontng.com,test,Love my test message] [udh:0:]
>>>
>>> I have my script that parse the file and extract as below
>>>
>>> To: maruna¡ontng.com Subject: test Message: Love my test message  sender
>>> :
>>> [EMAIL PROTECTED]
>>>
>>>
>>> What i want to achieve is to translate the to address back to
>>> [EMAIL PROTECTED] instaed of maruna¡ontng.com.
>>>
>>> when i checked through, i discover that it is inverted exclamation mark
>>> with
>>> character code 00A1 from unicode(hex) of latin-1 subset. I need this
>>> translated to @, any help will be appreciated
>>>
>>>
>>> my script is as below
>>>
>>> #!/usr/bin/perl
>>>
>>> use strict;
>>> use warnings;
>>> use File::Tail;
>>> use Mail::Sender;
>>>
>>>
>>> # the access.log is read and the following, recepient is extracted.
>>>
>>> my $name = "/var/log/bulksms/sms_access.log";
>>> my ($mailreci, $mailsubj, @sms, $mailmsg, $mailsend, $sendee, $sender,
>>> $msg,
>>> $domain);
>>> $domain = 'ontng.com';
>>> open my $file, '<', $name or die "could not open $name: $!";
>>> $file=File::Tail->new(name=>$name, maxinterval=>3, adjustafter=>5);
>>> while (defined($_=$file->read))
>>>   {
>>>   @sms = split/\[/;
>>>   next unless $sms[6]=~/to:\+2349191\]/;
>>>   $sendee = $sms[5];
>>>   $sendee =~ s/from:\+(\d+)\]/$1/;
>>>   $sendee = "[EMAIL PROTECTED]";
>>>   $msg = $sms[8];
>>>   $msg = (split/:/, $msg)[-1];
>>>   $msg =~ s/(\w+)\s?\]/$1/;
>>> #   i need only sender and $msg
>>>   ($mailreci, $mailsubj, $mailmsg) = (split/,/, $msg, 3)[0..2];
>>>
>>>   print  "To: $mailreci Subject: $mailsubj Message: $mailmsg sender :
>>> $sendee\n";
>>>
>>>}
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>> http://learn.perl.org/
>>>
>>>
>>>
>>>
>>
>>
>>
> its not an exclamation mark but inverted exclammation mark.
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>


Re: I could not do it with matlab could perl do it?

2008-06-30 Thread Aruna Goke

Amit Saxena wrote:

$str= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457  NAmitotic
spindle elongation  YBL084C '

(undef, undef, undef, $var1, $var2) = split (/\s*/, $str);

On Wed, Jun 25, 2008 at 1:20 PM, fadlyemen <[EMAIL PROTECTED]> wrote:


Hi All
I could not do it with matlab could perl do it?
I appreciate if I have solution for this problem
I  try to extract two columns from a text file(8 columns) with
variable
number of headerlines, and variable line length.
below is one line of my data


S= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457  NA
mitotic

spindle elongation  YBL084C '

How  could I get column 4 , 5 using perl.

Fadl


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/







$str= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457 
NAmitotic';


($col4, $col5)=(split/\s+/, $str)[3,4];

print "$col4 $col5";

goksie

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: I could not do it with matlab could perl do it?

2008-06-30 Thread Amit Saxena
$str= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457  NAmitotic
spindle elongation  YBL084C '

(undef, undef, undef, $var1, $var2) = split (/\s*/, $str);

On Wed, Jun 25, 2008 at 1:20 PM, fadlyemen <[EMAIL PROTECTED]> wrote:

> Hi All
> I could not do it with matlab could perl do it?
> I appreciate if I have solution for this problem
> I  try to extract two columns from a text file(8 columns) with
> variable
> number of headerlines, and variable line length.
> below is one line of my data
>
>
> S= 'GO:022  0.00312066574202497 9/2884  1/597   0.0023457  NA
> mitotic
>
> spindle elongation  YBL084C '
>
> How  could I get column 4 , 5 using perl.
>
> Fadl
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>


Re: Automation

2008-06-30 Thread Rodrick Brown
On Mon, Jun 30, 2008 at 3:26 AM, Ram <[EMAIL PROTECTED]> wrote:

> Hi All,
>
> I am begineer to perl language. Want help for the automation of the
> perl script.
> Is it possible to run a perl script at defined time interval without
> cliking over the scipt and using command prompt.
>
> I want it run without any GUI. it shoud run automatically at defined
> time ?
>
> Please give your valuable suggestions
>
> Thanks in advance.
>
> Ram
>

This is independent of Perl,you need some kind of process scheduler such as
autosys, or maestro, Linux/UNIX systems today come bundled with a system
level process scheduler called crontab and at. I believe Windows systems
also support at or you can get crontab from cygwin on Windows.


>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>


-- 
[ Rodrick R. Brown ]
http://www.rodrickbrown.com http://www.linkedin.com/in/rodrickbrown


Re: Automation

2008-06-30 Thread Jeff Peng
On Mon, Jun 30, 2008 at 3:26 PM, Ram <[EMAIL PROTECTED]> wrote:

>
> I want it run without any GUI. it shoud run automatically at defined
> time ?
>

Perl script is running without GUI normally unless you use TK.
"crontab" or "at" commands under unix can do what you wanted.
please man them for details.


-- 
Regards,
Jeff. - [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: looping

2008-06-30 Thread Jeff Peng
On Mon, Jun 30, 2008 at 3:24 PM, dakin999 <[EMAIL PROTECTED]> wrote:

>
> While I am reading each row data that is fetched by select query from
> oracle databae, I need to read some other values from a text file.
> This is where I am having issues. Can some one help me in formalising
> the write syntax (code) for doing these two thengs.

DBI has fetchrow_arrayref and fetchrow_hashref methods, you may check those.
The code logic could be:

while(my $ref = $sth->fetchrow_hashref) {
my $cond = get_another_condition($ref);
handle_it($ref,$cond);
}

sub get_another_condition {
my $r = shift;
open FD,"original.txt" or die $!;
# read from FD and do something with $r;
close FD;
# return something;
}


-- 
Regards,
Jeff. - [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Automation

2008-06-30 Thread Eko Budiharto
you can use crontab in linux.

On Mon, Jun 30, 2008 at 2:26 PM, Ram <[EMAIL PROTECTED]> wrote:

> Hi All,
>
> I am begineer to perl language. Want help for the automation of the
> perl script.
> Is it possible to run a perl script at defined time interval without
> cliking over the scipt and using command prompt.
>
> I want it run without any GUI. it shoud run automatically at defined
> time ?
>
> Please give your valuable suggestions
>
> Thanks in advance.
>
> Ram
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>


-- 
Eko Budiharto


looping

2008-06-30 Thread dakin999
Hi,

I am writting a perl script which:

1. Calls oracle database and produce the desired results

While I am reading each row data that is fetched by select query from
oracle databae, I need to read some other values from a text file.
This is where I am having issues. Can some one help me in formalising
the write syntax (code) for doing these two thengs.

Remember, I am reading row entry and then have to read one line at a
time for each of the row(s) from another text file and do some further
processing.

Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Automation

2008-06-30 Thread Ram
Hi All,

I am begineer to perl language. Want help for the automation of the
perl script.
Is it possible to run a perl script at defined time interval without
cliking over the scipt and using command prompt.

I want it run without any GUI. it shoud run automatically at defined
time ?

Please give your valuable suggestions

Thanks in advance.

Ram


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/