Hi Mazhar,

You have to escape @ sysmbol .Inside double quote perl will interpolate the value of @ and it will think @04 is an array
so
try
#!/usr/bin/perl -w
use strict;
use warnings;

my $string="[EMAIL PROTECTED]";

print $string;
Correct me if i am wrong
Thanks
Swayam



----- Original Message ----- From: "Mazhar" <[EMAIL PROTECTED]>
To: "Jaime Murillo" <[EMAIL PROTECTED]>
Cc: <beginners@perl.org>
Sent: Thursday, April 06, 2006 2:41 PM
Subject: Re: Help Required on the Script


Thank you giyz for the help i require one more help from yourside. i have
one more code where in i am getting error on print of a value of a variable,


below is the code

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

my $string="[EMAIL PROTECTED]";

print $string;

On executing the above i get the below error...
------------------------------------------------------------------------

In string, @04 now must be written as [EMAIL PROTECTED] at regular.pl line 5, near 
"
[EMAIL PROTECTED]"
Execution of regular.pl aborted due to compilation errors.


Your help is required

Regards
Mazhar

On 4/5/06, Jaime Murillo <[EMAIL PROTECTED]> wrote:

On Tuesday 04 April 2006 23:46, Mazhar wrote:
> Hi Guyz,

Hi Mazhar,

>             i am writin a script to automate the command snmpwalk by
> reading the contents of a file. Below is the snippet
>
> $file_name="somefile.txt";
>
> open(FILE,"< $file_name");
>
> while(<FILE>)
> {
>         my $ip;
>         my $comm_string;
>         ($ip,$comm_string)=split(",",$_);
>         $tempRNA=qw("snmpwalk -t 1 -r 1 $ip $comm_string
.1.3.6.1.2.1.1.5 >
> RNA$ip.txt");
>

This might work for you

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

my $file_name = "somefile.txt";

open(FILE, "< $file_name") or die("Error opening $file_name: $!\n");

while(<FILE>)
{
        chomp;
        my ($ip, $comm_string) = split ",";
        my $tempRNA = "snmpwalk -t 1 -r 1 $ip $comm_string
.1.3.6.1.2.1.1.5 >
RNA$ip.txt";

        print "$tempRNA\n";
}

Good luck

> *** I am facing the problem in the above code where in i have to pass
all
> the information to the variable $tempRNA and then execute the same in
the
> System ($tempRNA)
>
> When i try to print the value in the variable $tempRNA i am getting the
> value printed only RNAxx.xxx.xxx.xxxx.txt
>
> Please help me out and Thanks is Advance
>
> Regards
> Mazhar

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





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


Reply via email to