Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$input = "users.txt"
$id = 'line I want to edit';
open(INPUT, "<$users"); # open the file to read it
@data = <INPUT>; # read the whole file into an array
close(INPUT); # close the file
open (OUTPUT, ">$users"); # now open it to write to
flock(OUTPUT, 2); # and lock it
for ($i=0;$i<$#data+1;$i++) { # for each line in the array
chomp($data[$i]); # get rid of any trailing new-line character
if ( $id eq $data[$i] ) { # if it matches the data I'l looking for
$data[$i] = "new data"; # replace it
print OUTPUT "$data[$i]\n"; # write the changed line out to the file
} else { # otherwise
print OUTPUT "$data[$i]\n"; # write the unchanged line out to the file
}
}
flock(OUTPUT, 8); # unlock the file
close(OUTPUT); # and close it