S
sivga
hello experts,
Iam new to perl .Can you pls suggest how to do this this is wat iam
trying to do i have a text file with following lines
exact 5
seasad 3
switch text 1.2
new data 20
cd data 10
phase 30
extra 40
same 200
different 500
wat i need do is i neeed to read the file and if the file has (matches)
switch text i need to write switch text to a new file say k2 and the
next four lines new data ,cd data,extra and phase to k2 .other wise no
need to write to the file k2. ,I cannot form the string say new data cd
data and write to a file coz the numbers at the end will differ .How do
i do it ?
while (<AG>) {
if ($_ =~ /exact +([0-9]+)/ ) {
print k1 " $_";
} elsif ( $_ =~ /switch text /) {
print k2 "$_";
} elsif ($_ =~ /same/) {
print k1 "$_";
}
Thanks for the help
Iam new to perl .Can you pls suggest how to do this this is wat iam
trying to do i have a text file with following lines
exact 5
seasad 3
switch text 1.2
new data 20
cd data 10
phase 30
extra 40
same 200
different 500
wat i need do is i neeed to read the file and if the file has (matches)
switch text i need to write switch text to a new file say k2 and the
next four lines new data ,cd data,extra and phase to k2 .other wise no
need to write to the file k2. ,I cannot form the string say new data cd
data and write to a file coz the numbers at the end will differ .How do
i do it ?
while (<AG>) {
if ($_ =~ /exact +([0-9]+)/ ) {
print k1 " $_";
} elsif ( $_ =~ /switch text /) {
print k2 "$_";
} elsif ($_ =~ /same/) {
print k1 "$_";
}
Thanks for the help