Todd am Mittwoch, 17. August 2005 17.45:
> Thanks.
>
> I tried to simplify a couple of things when I sent out the first email to
> make it easier for help. Sorry for the type-o. The single quotes wont work
> with this though:
>
> $hexval="011884455667733";

The choosed quoting operator above won't give a mess.
Better use single quotes; nothing must be interpolated.

> $newval='hba0-SCSI-target-id-7-name="$hexval"';

You have to choose qq() above, which does not conflict with the double quotes 
around $hexval but interpolates it.

see perldoc perlop (in the bottom part, "Interpolation")

> @output = `/usr/bin/perl -p -i -e
> "s/hba0-SCSI-target-id-1-name=(.*)/$newval/;" /kernel/drv/qla2300.conf`;

the s/// here substitutes the whole string with $newval.

I guess what you want is something like:

s/(hba0-SCSI-target-id-1-name=).*/$1$newval/;
or 
s/(hba0-SCSI-target-id-1-name=").*?(")/$1$newval$2/;
or
s/(hba0-SCSI-target-id-1-name=).*/$1"$newval"/;

But I'm confused: Did you mean $hexval?

> becuase I neglected to tell you I am using a variable name in there as well
> ($hexval).
>
> How can I get the string:
>
> hba0-SCSI-target-id-7-name="011884455667733"
>
> to appear in my qla2300.h file? 

What qla2300.h file? The file you print @output into?

> That   s/old/new    command will not put my quotes in the file??

s/old/new will only replace patterns in $_ .

[...]

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