Hello ,
Hope this helps you.
open(FILE2,"+;
@found = grep(/server_lib\.files/,@text);
$arsize=$#found+1;
if($arsize>0)
{
print "seen server_lib.files";
}
else
{
print "not seen server_lib.files";
my $header = "[server_lib.files]";
print FILE2 "\n";
print FILE2 $header;
print FILE2 "\n";
}
On 7
Hi:
I tried the following --
open(FILE2,">>c:/writeto.txt");
my @text = ;
foreach my $a(@text)
{
print(@text);
if ($a !~ /server_lib\.files/)
{
print "not seen server_lib.files";
my $header = "[server_lib.files]";
print FILE2 "\n";
print FILE2 $header;
print FILE2 "\n";
}
else
{
On 7/12/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote:
Hi:
I would like to check whether the string [server_bin.files] exists in a
particular file and if it does, then do not add it again.
How can I check for this string using perl regex?
Perl Faq 4
print "seen server_bin.files" if /server_bin\