0% found this document useful (0 votes)
20 views3 pages

Perl and PHP String Manipulation Guide

Uploaded by

Siyana Sri
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Perl and PHP String Manipulation Guide

Uploaded by

Siyana Sri
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

use strict;

use warnings;

use feature qw(say);

my $college="king nandhivarman college of arts and science king";

say"the above string lowercase is\n\t\t",lc($college);

say"My above string uppercase is\n\t\t",uc($college);

say"the length of the string is\n\t\t",length($college);

#my $index="king";

say"the repeated name of the string\n\t\t",$college x 3;

say"the string king accured in college at\n\t\t",index($college,"king");

say"the string king accured in college at\n\t\t",index($college,"hai");

my @letters=("a"..."e");

say @letters[0...4];

say "join letters are\n\t\t",join(":",@letters);

say "the reverse of the letters is\n\t\t",(reverse(@letters));

say "the words in college are\n\t\t",split(/ /,$college);

say "the comma separeded words in the string are\n\t\t",join(",",split(/ /,$college));

say " the reverse of the string is";

print scalar reverse("$college");

file program

<!DOCTYPE html>

<html>
<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>PHP file create and write Example</title>

</head>

<body>

<form method="POST">

<h3>reading and writing a files</h3>

Enter String:<input type="text" name="name"><br/><br/>

<input type="submit"name="submit1" value="Write files">

<input type="submit"name="submit2" value="Read File">

</form>

<?php

if (isset($_POST['submit1'])) {

$myfile=fopen("[Link]","a");

$text=$_POST["name"];

fwrite($myfile,$text);

fclose($myfile);

if (isset($_POST['submit2'])) {

$myfile=fopen("[Link]","r");

echo fgets($myfile);

fclose($myfile);

?>
</body>

</html>

You might also like