[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
wrote: 
: I have a field that looks like this:
: 
: 'modprobe: modprobe: Can't locate module char-major-10-134'
: 
: I need to add a single quote so that it looks like this:
: 
: 'modprobe: modprobe: Can''t locate module char-major-10-134'
: 
: But I have no idea how to go about doing that, can I get an example?

    I wasn't sure if those single quotes were part of the field or
just delimiters.


#!/usr/bin/perl

use strict;
use warnings;

$_ = "modprobe: modprobe: Can't locate module char-major-10-134";

s/'/''/g;

print;

# OR

$_ = "'modprobe: modprobe: Can't locate module char-major-10-134'";

s/(\w)'(\w)/$1''$2/g;    # There is probably a more
                         # elegant way to write this.
print;

__END__


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328



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