tructure is printed to display the contents read from the file. # Read Contents of File # # Specify the file that needs to be read $fileName = '/root/test.txt' File Handling # Open the File for reading open (FILE, $fileName) i # Read file contents into an array lines = <FILE>; # Close file after reading to array close (FILE) ; # Print contents of the array print @lines ; 2. Write data to file: In this example, data is written to a file opened in write mode. After write operation with this program, the contents of the file can be verified using the program to read file. Write Data to File # Define the data to be written $str = "Write this to file"; # Open the file in write mode open FILE, ">/root/test.txt" ; # Write the pre-defined string to file print FILE $str; # Close the file after writing close FILE; 3. Manipulating files: In this example file manipulation with PERL is dis- cussed. Every high level programming language has its own set of APIs for file manipulation. This example is just to introduce the reader to general file manipulations that are done in programming. File Manipulation All files are assumed to be in the current directory remove file with name "test" using rm command rm test; # rename file "old_name" to "new name" using rename command Fundamentals of EMS, NMS and OSS/BSS rename "old name" "new name"; # change file permissions on the file chmod 777 new name; # create link to a file link "test1", "test2"; # unlink a created link unlink test2; 4. FTP client: This example shows a FTP client implementation in PERL programming language. It uses Net::FTP library in PERL for implemen- tation. The example shows an FTP client that gets a file from a remote server. FTP Client # Create an instance using new method # It defines a connection to a remote server $ftpHandle = Net: FTP -> new "ftp.crcpress.com" ; # Login to the server $ftpHandle - > login (); # Specify the user id and password $ftpHandle->login ("jithesh", "password") ; # Move to the directory that contains required file $ftpHandle-> >cwd ("/ro