Re: Recursive routine

2008-06-17 Thread Dermot
2008/6/16 Rob Dixon <[EMAIL PROTECTED]>:
> Dermot wrote:
>> Hi All,
...snip
> I think you are better off using a simple global regex match Dermot.
>
>my @f =$str =~ /[A-Z][a-z]+/g;
>
> That finds all instances of a capital letter followed by one or more lower 
> case
> letters.

Well both varieties work. I swear I had tried both of those methods
but the key was obviously the global flag and I didn't have that.
Sorry for the poor subject heading. I originally had attempted to do a
recursive substr() on the string but that got me no where except
really frustrated.

Thanx to you both.
Dp.

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




Re: Binary to Text/ASCii conversion

2008-06-17 Thread Jenda Krynicky
From:   "Anirban Adhikary" <[EMAIL PROTECTED]>
> Hi,
> 
> Actually we are working in the telecom industry, so our work resolves
> parsing the raw CDRs generated from the telecom switch(the format is ASN.1)
> . Till now it is being done through JAVA, but some requirement creeps in
> where we need to parse those CDRs through perl and convert those files into
> some text/ascii format.. We are in a confused state.

Maybe this'd help:
http://search.cpan.org/search?query=ASN.1&mode=module

And maybe there's someone else working with the same type of files 
here, I've never seen them. If this doesn't help, ask again and 
include the format in the subject. Or ask on www.perlmonks.org

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Capture URL parameter

2008-06-17 Thread luke devon
Dear Friends

I am going to capture some values/parameters which are comes trough URL. like 
Client_IP , domain name .etc. But i have no idea how it would be done by 
perl. Here i am going to use bcoz this program based on squid-cache server. 

Can somebody help me on this please.

Many Thanks
Luke


Send instant messages to your online friends http://uk.messenger.yahoo.com 

doubt in my web spider

2008-06-17 Thread Manasi Bopardikar
http://sac.edu/Schedule/search/results.asp?semester=Fall2008

&department=Accounting&AddTitle=-+Browse&RtnURL=%2Fschedule%2Fbrowse.asp?Sel
ected=Fall2008&RtnTxt=New+Browse

 

I need to scrape unique id fields viz 0103501 etc and 'AND' following it
under QUICKBOOKS  to be put in one record and then write it to output
file.is there a simple way to do it.

 

Manasi Bopardikar

Software Engineer

Persistent Systems Ltd

Cell No:(+91)9767218759
Extn:+91-020-3023(4497)
Email:[EMAIL PROTECTED]

 


DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.


Re: Binary to Text/ASCii conversion

2008-06-17 Thread Dr.Ruud
"Anirban Adhikary" schreef:

> our work resolves
> parsing the raw CDRs generated from the telecom switch(the format is
> ASN.1) . Till now it is being done through JAVA, but some requirement
> creeps in where we need to parse those CDRs through perl and convert
> those files into some text/ascii format.. We are in a confused state.

Did you check the CPAN? There is a Convert::ASN1, but there are many
more ASN-related modules.
http://search.cpan.org

-- 
Affijn, Ruud

"Gewoon is een tijger."


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




Re: Capture URL parameter

2008-06-17 Thread Octavian Rasnita
From: "luke devon" <[EMAIL PROTECTED]>
Dear Friends

I am going to capture some values/parameters which are comes trough URL. like 
Client_IP , domain name .etc. But i have no idea how it would be done by 
perl. Here i am going to use bcoz this program based on squid-cache server. 

Those environment vars don't come in the URL, but are sent in the HTTP headers 
or are set by the web server.

If you want to get the names and values of all vars, you could use a script 
like:

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "$_=$ENV{$_}" foreach sort keys %ENV;

Octavian


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




Re: Capture URL parameter

2008-06-17 Thread luke devon
Hi Octavian, Thank you so much . I used it and got a huge out put .
anyway when I explore my requirement , its like this , in following
example

http://somethig.com/?name=&number=22

How would i filter that "name" and "number" parameter form the request url ?? 
Could you please help me ?

Thank you
Luke.



- Original Message 
From: Octavian Rasnita <[EMAIL PROTECTED]>
To: luke devon <[EMAIL PROTECTED]>; Perl 
Sent: Tuesday, June 17, 2008 14:32:34
Subject: Re: Capture URL parameter

From: "luke devon" <[EMAIL PROTECTED]>
Dear Friends

I am going to capture some values/parameters which are comes trough URL. like 
Client_IP , domain name .etc. But i have no idea how it would be done by 
perl. Here i am going to use bcoz this program based on squid-cache server. 

Those environment vars don't come in the URL, but are sent in the HTTP headers 
or are set by the web server.

If you want to get the names and values of all vars, you could use a script 
like:

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "$_=$ENV{$_}" foreach sort keys %ENV;

Octavian

Send instant messages to your online friends http://uk.messenger.yahoo.com 

Removing special character from first line in CSV file

2008-06-17 Thread suyog_linux
Hi All,

I am new to perl coding and I am working with a CSV file where I have
to remove all the double quotes (") from the first line of the file.

I need a code that I can embed in a .pl file. Could somebody help me
with this ?

Thanks,
Suyog


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




Perl Script

2008-06-17 Thread dakin999
I am looking for any generic perl code that is doing some thing like
following. Any code help will be really helpful.

1. Reads from a database(oracle) following columns:
Customer_No, Fname, Lname, Password.


2. Encrypts the password in SHA1_Base64 format.


3. Use the perl-ldap add object to create a ldif record with the same
columns  (as in step 1, but password in the SHA1_Base64 encrypted
string).


4. Create a CSV file with same columns as in step 1, exculding the
password.


5. Add the ldif data into SUN LDAP directory.


Thanks in advance.


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




Re: Recursive routine

2008-06-17 Thread Nayab
On Jun 16, 9:33 pm, [EMAIL PROTECTED] (Rob Dixon) wrote:
> Dermot wrote:
> > Hi All,
>
> > I have data in a tab delimited format like this (tabs might be lost in
> > the formatting of the email).
>
> > A456/959        ScHe
> > M920/1123      He
> > D123/999        ChFl
> > D123/949        AnFl
> > S520/257   Sp
> > T510/106    TePeHe
> > T540/110    Te
> > T875/1010  TeSc
> > T875/1050  TeSc
>
> > I need to split the 2nd column. The string is to be split into 2
> > characters , so ChFl becomes 'Ch, Fl' . I can't seem to find a RE that
> > will split the data correctly. My best effort is below but is captures
> > everything into $f[0], there is no splitting at all. I also tried my
> > hand at a recursive subroutine but that caused a lot deep recursion
> > errors.
>
> > Can anyone offer a bit of advise here?
> > Thanx,
> > Dp.
>
> > #!/bin/perl
>
> > use strict;
> > use warnings;
> > use Text::Tabfile;
>
> > my $file = 'myfile.txt';
> > my $tabfile = new Text::TabFile;
> > $tabfile->open($file);
>
> > my @headers = $tabfile->fields;
>
> > while (my $row = $tabfile->read) {
> >    my $str = $row->{'code'};
> >    my @f = split(/(?=\b[A-Z][a-z]\b)/, $str);
> >    print qq($row->{'number'}, "$f[0]" "$str"\n");
>
> >    #print $row->{'number'},"\t";
> >    #for (@f) {
> >    #       print $_,',';
> >    #}
> >    #print "\n";
> > }
>
> I think you are better off using a simple global regex match Dermot.
>
>     my @f =$str =~ /[A-Z][a-z]+/g;
>
> That finds all instances of a capital letter followed by one or more lower 
> case
> letters.
>
> HTH,
>
> Rob- Hide quoted text -
>
> - Show quoted text -

U can use:
while() {
if ($_ =~ /(.*?)(\t)(\w{2})(.*)/){
print "$3\n";
}


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




Re: Removing special character from first line in CSV file

2008-06-17 Thread Dermot
2008/6/17 suyog_linux <[EMAIL PROTECTED]>:
> Hi All,

Hi,
> I am new to perl coding and I am working with a CSV file where I have
> to remove all the double quotes (") from the first line of the file.

Could you send us what you've tried so far. It works better if we can
see what you've tried and point out where you could improve :-)
Dp.

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




Re: Perl Script

2008-06-17 Thread Jeff Peng
On Tue, Jun 17, 2008 at 10:46 AM, dakin999 <[EMAIL PROTECTED]> wrote:
> I am looking for any generic perl code that is doing some thing like
> following. Any code help will be really helpful.

I don't think there is such a "general" script.
Maybe you can write one.


-- 
Jeff Peng - [EMAIL PROTECTED]
Professional Squid supports in China
http://www.ChinaSquid.com/

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




Re: Perl Script

2008-06-17 Thread Gunnar Hjalmarsson

dakin999 wrote:

I am looking for any generic perl code that is doing some thing like
following. Any code help will be really helpful.

1. Reads from a database(oracle) following columns:
Customer_No, Fname, Lname, Password.

2. Encrypts the password in SHA1_Base64 format.

3. Use the perl-ldap add object to create a ldif record with the same
columns  (as in step 1, but password in the SHA1_Base64 encrypted
string).

4. Create a CSV file with same columns as in step 1, exculding the
password.

5. Add the ldif data into SUN LDAP directory.


Anything wrong with the hints you got in comp.lang.perl.misc?

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

--
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/




Difference between system() and exec() and ``

2008-06-17 Thread swaroop
As we know there are 3 ways a system shell command to be executed.

1.> $var = system("command");
2.> $var = exec("command");
3.> $var = `command`;

What is difference between these three?  I found that the first two
options are printing the output of the command.  And the third one
simply stores the output in the variable.


Regards
Swaroop


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




Fwd: How attach files and send mails on perl????

2008-06-17 Thread Armin Garcia
-- Forwarded message --
From: Armin Garcia <[EMAIL PROTECTED]>
Date: Tue, Jun 17, 2008 at 12:44 PM
Subject: Re: How attach files and send mails on perl
To: [EMAIL PROTECTED]



hi

well i have some problems again, thats my new code:


#!/usr/bin/perl -w


#Modulos
use MIME::Lite;
use warnings;
use strict;

##
Configuration
##
##

#Ruta del directorio donde se encuentran los attach del email
$attach_path="/home/agarcia/HoneyClient/To\-Email";

#log path
$log_path="/home/agarcia/HoneyClient/To\-Email/log";

#ruta donde se localiza el script para parsear las bitacoras de CaptureHPC
$hpc_log_home="/usr/local/Honeyclient/HoneyClient3/ScriptHoney/capture-server-2.1.0-300";

##
Funciones
##
##

sub SendEmailwAttach{
print "Estoy aqui  tratando de enviar el mail\n";
my $attache= shift(@_);
print "attache=$attache";
$msg=new MIME::Lite;
$msg = MIME::Lite->new(
From=>  '[EMAIL PROTECTED]',
To  =>  '[EMAIL PROTECTED]',
#Cc =>  '[EMAIL PROTECTED]',
Subject =>  'Reporte de Urls Maliciosas...',
Type=>  'multipart/mixed'
);

@data=`./hpc-log-parser.sh $log_path`;
print @data;
### Aqui coloca el texto que deseas :
### (Note that "attach" has same arguments as "new"):
$msg->attach(
Type =>'TEXT',
Data => "@data"
);

### Aqui agrega el archivo que quieres:
$msg->attach(
   * Type => 'x-gzip',
Path => "gzip < $attache |", <- i think here
is the problem but i dont know why*
ReadNow  => 1,
Filename => 'backup.tgz',
Disposition => 'attachment'
) or die "ERROR: here in the attach ...$!";

print "Listoo \n";
}

sub Main{

my $aux;

@tmp=`ls $attach_path`;
foreach (@tmp){
if ($_ =~ /backup*/){
$aux=$_;
}
}

$file="$attach_path/$aux";
print "archivo=$file";

if ( $file ){
print "Enviando Email w attach\n";
SendEmailwAttach($file);
}else{
print "sorry, es un directorio, $aux\n";
}
}

Main();


Well the problem is i recibe the next output on my terminal when i execute
this script

*Unsuccessful stat on filename containing newline at
/usr/local/share/perl/5.8.8/MIME/Lite.pm line 1549.

I dont understand what does mean ... :s

when first, only i cant attach files using a variable, this is my problem,
if i put a file with the correct name and path, no problem, but my problem
is in this directory this file changes with the time

I hope somebody helps me, and if you have some tips, all of them are welcome
!!!
*


thanks


Re: How attach files and send mails on perl????

2008-06-17 Thread Armin Garcia
hi

well i have some problems again, thats my new code:


#!/usr/bin/perl -w


#Modulos
use MIME::Lite;
use warnings;
use strict;

##

Configuration
##
##

#Ruta del directorio donde se encuentran los attach del email
$attach_path="/home/agarcia/HoneyClient/To\-Email";

#log path
$log_path="/home/agarcia/HoneyClient/To\-Email/log";

#ruta donde se localiza el script para parsear las bitacoras de CaptureHPC
$hpc_log_home="/usr/local/Honeyclient/HoneyClient3/ScriptHoney/capture-server-2.1.0-300";

##
Funciones
##
##

sub SendEmailwAttach{
print "Estoy aqui  tratando de enviar el mail\n";
my $attache= shift(@_);
print "attache=$attache";
$msg=new MIME::Lite;
$msg = MIME::Lite->new(
From=>  '[EMAIL PROTECTED]',
To  =>  '[EMAIL PROTECTED]',
#Cc =>  '[EMAIL PROTECTED]',
Subject =>  'Reporte de Urls Maliciosas...',
Type=>  'multipart/mixed'
);

@data=`./hpc-log-parser.sh $log_path`;
print @data;
### Aqui coloca el texto que deseas :
### (Note that "attach" has same arguments as "new"):
$msg->attach(
Type =>'TEXT',
Data => "@data"
);

### Aqui agrega el archivo que quieres:
$msg->attach(
   * Type => 'x-gzip',
Path => "gzip < $attache |", <- i think here
is the problem but i dont know why*
ReadNow  => 1,
Filename => 'backup.tgz',
Disposition => 'attachment'
) or die "ERROR: here in the attach ...$!";

print "Listoo \n";
}

sub Main{

my $aux;

@tmp=`ls $attach_path`;
foreach (@tmp){
if ($_ =~ /backup*/){
$aux=$_;
}
}

$file="$attach_path/$aux";
print "archivo=$file";

if ( $file ){
print "Enviando Email w attach\n";
SendEmailwAttach($file);
}else{
print "sorry, es un directorio, $aux\n";
}
}

Main();


Well the problem is i recibe the next output on my terminal when i execute
this script

*Unsuccessful stat on filename containing newline at
/usr/local/share/perl/5.8.8/MIME/Lite.pm line 1549.

I dont understand what does mean ... :s

when first, only i cant attach files using a variable, this is my problem,
if i put a file with the correct name and path, no problem, but my problem
is in this directory this file changes with the time

I hope somebody helps me, and if you have some tips, all of them are welcome
!!!
*


thanks


Re: Difference between system() and exec() and ``

2008-06-17 Thread Jeff Peng
On Tue, Jun 17, 2008 at 1:47 PM, swaroop <[EMAIL PROTECTED]> wrote:
> As we know there are 3 ways a system shell command to be executed.
>
> 1.> $var = system("command");
> 2.> $var = exec("command");
> 3.> $var = `command`;
>
> What is difference between these three?  I found that the first two
> options are printing the output of the command.  And the third one
> simply stores the output in the variable.

`command` for capturing the command's output and assign it to a variable.
for what's the difference between system and exec, see 'perldoc -q "exec"'.


-- 
Jeff Peng - [EMAIL PROTECTED]
Professional Squid supports in China
http://www.ChinaSquid.com/

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




Re: Fwd: How attach files and send mails on perl????

2008-06-17 Thread Gunnar Hjalmarsson

Armin Garcia wrote:


sub Main{

my $aux;

@tmp=`ls $attach_path`;
foreach (@tmp){
if ($_ =~ /backup*/){
$aux=$_;
}
}


Try inserting

chomp $aux;

here.


$file="$attach_path/$aux";





Well the problem is i recibe the next output on my terminal when i execute
this script

*Unsuccessful stat on filename containing newline at
/usr/local/share/perl/5.8.8/MIME/Lite.pm line 1549.

I dont understand what does mean ... :s


It says that a filename passed to MIME::Lite contains a newline, which 
means that it contains a newline...  See suggested fix above.


--
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: Difference between system() and exec() and ``

2008-06-17 Thread Chas. Owens
On Tue, Jun 17, 2008 at 01:47, swaroop <[EMAIL PROTECTED]> wrote:
> As we know there are 3 ways a system shell command to be executed.
>
> 1.> $var = system("command");
> 2.> $var = exec("command");
> 3.> $var = `command`;
>
> What is difference between these three?  I found that the first two
> options are printing the output of the command.  And the third one
> simply stores the output in the variable.

The exec function* replaces the current process with the one specified
in the arguments, so exec("bash", "-l") would replace the perl process
with bash login shell running interactively.  This is most often not
what you want to do.  You want to run an external program and wait for
it to finish.  To do this you would need to fork the current process
into two processes (parent and child) and replace the child process
with an exec call to the external program while the parent process
waits for the child process to complete.  This is what the system
function** does.  It is implemented in terms of a fork***, an exec,
and a waitpid.  Due to the way fork works the file handles of the
parent are inherited by the child, so STDOUT and STDERR in the process
created by system are the same as in the Perl program.  This is why
output shows up when you use system or exec.

The qx// operator* (also known as ``) is very different.  It is
most likely implemented via the popen** function from
SUSv2***.  It captures the STDOUT (but not the STDERR) of an
external program and returns it as a list of lines (in list context)
or as string (in scalar context).

Other options for running (and capturing output/providing input)
include the open function (STDOUT or STDIN only),
IPC::Open2* (STDIN and STDOUT), and IPC::Open3**
(STDIN, STDOUT, and STDERR).

If you are not writing a quick and dirty program the open function is
preferable to the qx// operator because you have more control and the
output data shows up as soon as possible (rather than at the end of
the external program's run):

open my $output, "-|", "program_to_execute", "argument 1", "argument 2"
or die "could not run program: $!";

while (my $line = <$output>) {
#do something with a line printed by program_to_execute
#$line shows up here as soon as it is flushed
}

IPC::Open2 and IPC::Open3 provide even more control, and are useful
for puppet stringing other programs.

* http://perldoc.perl.org/functions/exec.html
** http://perldoc.perl.org/functions/system.html
*** http://perldoc.perl.org/functions/fork.html
 http://perldoc.perl.org/functions/waitpid.html
* http://perldoc.perl.org/perlop.html#qx/STRING/
** http://www.opengroup.org/onlinepubs/007908799/xsh/popen.html
*** Single UNIX Specification, the thing that replaced POSIX, see
http://en.wikipedia.org/wiki/Single_UNIX_Specification
 http://perldoc.perl.org/functions/open.html
* http://perldoc.perl.org/IPC/Open2.html
** http://perldoc.perl.org/IPC/Open3.html

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

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




Re: Difference between system() and exec() and ``

2008-06-17 Thread Gunnar Hjalmarsson

swaroop wrote:

As we know there are 3 ways a system shell command to be executed.

1.> $var = system("command");
2.> $var = exec("command");
3.> $var = `command`;

What is difference between these three?


You should not have asked that question here; you should have looked up 
the answer in the docs. I think the best starting point is


perldoc -f system

Another thing would have been if you had made an attempt with the docs, 
and needed help to understand it. _That_ would have been a good reason 
to ask for help.


--
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: Difference between system() and exec() and ``

2008-06-17 Thread Rob Dixon
Gunnar Hjalmarsson wrote:
> swaroop wrote:
>> As we know there are 3 ways a system shell command to be executed.
>>
>> 1.> $var = system("command");
>> 2.> $var = exec("command");
>> 3.> $var = `command`;
>>
>> What is difference between these three?
> 
> You should not have asked that question here; you should have looked up 
> the answer in the docs.

  Sheesh!

  This is the first thing I read on perl.beginners after time away.

  Are you really from the Cocos Islands, Gunnar?

  I think you should talk to the other abusive people who like to post here and
  form a separate group.

  Rob

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




Re: Difference between system() and exec() and ``

2008-06-17 Thread Gunnar Hjalmarsson

Rob Dixon wrote:

Gunnar Hjalmarsson wrote:

swaroop wrote:

As we know there are 3 ways a system shell command to be executed.

1.> $var = system("command");
2.> $var = exec("command");
3.> $var = `command`;

What is difference between these three?
You should not have asked that question here; you should have looked up 
the answer in the docs.


  Sheesh!

  This is the first thing I read on perl.beginners after time away.

  Are you really from the Cocos Islands, Gunnar?

  I think you should talk to the other abusive people who like to post here and
  form a separate group.


I take it that you don't agree.

The OP wondered about two built-in functions and the backticks operator. 
I can't think of a more natural first step to find out how they work 
than reading about them in the Perl documentation. Do you mean that I'm 
abusive by suggesting that people make it a habit to use the docs at 
first hand? If that's what you mean, I think you are plain stupid.


--
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/




making do work with strict

2008-06-17 Thread beast
I just want to load variable from config file:

config.pl:

$basedir = '/home/user/';

myprog.pl:

#use strict;

do 'config.pl' or die "can not open config\n";

# do some stuff here


the problem is, i have to disable strict in myprog.pl. any other way to do it?
Thanks.


--budhi

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




Re: making do work with strict

2008-06-17 Thread Gunnar Hjalmarsson

beast wrote:

I just want to load variable from config file:

config.pl:

$basedir = '/home/user/';

myprog.pl:

#use strict;

do 'config.pl' or die "can not open config\n";

# do some stuff here

the problem is, i have to disable strict in myprog.pl. any other way to do it?


Declare the variable in myprog.pl.

our $basedir;

--
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/