This document provides an introduction and overview of Linux commands and Perl basics. It discusses key Linux commands for system information, user management, files/directories, permissions, processes, networking and more. It also covers Perl data types, variables, input/output, strings, arithmetic, comparisons, functions and file handling. The document aims to teach Linux commands and Perl programming basics.
I have tried my best to describe Samba Server through this PPT. I hope you guys will love this and this ppt will be helpful for you all.
Thanks,
Veeral Arora
I have tried my best to describe Samba Server through this PPT. I hope you guys will love this and this ppt will be helpful for you all.
Thanks,
Veeral Arora
Introduction to users and groups in Linux. We will explore how to set user expiry information and force user password change after certain period of time. We will be also providing different permission to users and groups and restricting users and groups operations using sudoers file
Here I covered the cores of Apache and also discuss each and every core. Virtual host, resistance server process some protocols like HTTP, SMTP, DNS FTP, are also be highlighted.
Focus on some installing part of apache.
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...Edureka!
This Linux Tutorial will help you get started with Linux Administration. This Linux tutorial will also give you an introduction to the basic Linux commands so that you can start using the Linux CLI. Do watch the video till the very end to see all the demonstration. Below are the topics covered in this tutorial:
1) Why go for Linux?
2) Various distributions of Linux
3) Basic Linux commands: ls, cd, pwd, clear commands
4) Working with files & directories: cat, vi, gedit, mkdir, rmdir, rm commands
5) Managing file Permissions: chmod, chgrp, chown commands
6) Updating software packages from Linux repository
7) Compressing & Decompressing files using TAR command
8) Environment variables and Regular expressions
9) Starting and killing processes
10) Managing users
11) SSH protocol for accessing remote hosts
A Day In The Life Of A Linux AdministratorEdureka!
Linux is everywhere. In your daily life, you are communicating with Linux servers, major internet sites such as Facebook and Google are using Linux servers. In addition, most modern televisions and Android mobiles run on Linux. At the root of it, Linux is free software used to control desktop, laptop, supercomputers, mobile devices, networking equipment, airplanes and automobiles and so on. With Linux knowledge and an inexpensive computer you can create tiny gadgets at home, making it a widely acclaimed weapon in your skills' armour.
A comprehensive walkthrough of how to manage infrastructure-as-code using Terraform. This presentation includes an introduction to Terraform, a discussion of how to manage Terraform state, how to use Terraform modules, an overview of best practices (e.g. isolation, versioning, loops, if-statements), and a list of gotchas to look out for.
For a written and more in-depth version of this presentation, check out the "Comprehensive Guide to Terraform" blog post series: https://blog.gruntwork.io/a-comprehensive-guide-to-terraform-b3d32832baca
Understanding the Windows Server Administration Fundamentals (Part-1)Tuan Yang
Windows Server Administration is an advanced computer networking topic that includes server installation and configuration, server roles, storage, Active Directory and Group Policy, file, print, and web services, remote access, virtualization, application servers, troubleshooting, performance, and reliability.
Learn more about:
» What is the Server?
» Server Roles.
» Server Hardware.
» Work groups & Domains.
» Device and printers.
» Windows Server OS Management tools.
Introduction to users and groups in Linux. We will explore how to set user expiry information and force user password change after certain period of time. We will be also providing different permission to users and groups and restricting users and groups operations using sudoers file
Here I covered the cores of Apache and also discuss each and every core. Virtual host, resistance server process some protocols like HTTP, SMTP, DNS FTP, are also be highlighted.
Focus on some installing part of apache.
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...Edureka!
This Linux Tutorial will help you get started with Linux Administration. This Linux tutorial will also give you an introduction to the basic Linux commands so that you can start using the Linux CLI. Do watch the video till the very end to see all the demonstration. Below are the topics covered in this tutorial:
1) Why go for Linux?
2) Various distributions of Linux
3) Basic Linux commands: ls, cd, pwd, clear commands
4) Working with files & directories: cat, vi, gedit, mkdir, rmdir, rm commands
5) Managing file Permissions: chmod, chgrp, chown commands
6) Updating software packages from Linux repository
7) Compressing & Decompressing files using TAR command
8) Environment variables and Regular expressions
9) Starting and killing processes
10) Managing users
11) SSH protocol for accessing remote hosts
A Day In The Life Of A Linux AdministratorEdureka!
Linux is everywhere. In your daily life, you are communicating with Linux servers, major internet sites such as Facebook and Google are using Linux servers. In addition, most modern televisions and Android mobiles run on Linux. At the root of it, Linux is free software used to control desktop, laptop, supercomputers, mobile devices, networking equipment, airplanes and automobiles and so on. With Linux knowledge and an inexpensive computer you can create tiny gadgets at home, making it a widely acclaimed weapon in your skills' armour.
A comprehensive walkthrough of how to manage infrastructure-as-code using Terraform. This presentation includes an introduction to Terraform, a discussion of how to manage Terraform state, how to use Terraform modules, an overview of best practices (e.g. isolation, versioning, loops, if-statements), and a list of gotchas to look out for.
For a written and more in-depth version of this presentation, check out the "Comprehensive Guide to Terraform" blog post series: https://blog.gruntwork.io/a-comprehensive-guide-to-terraform-b3d32832baca
Understanding the Windows Server Administration Fundamentals (Part-1)Tuan Yang
Windows Server Administration is an advanced computer networking topic that includes server installation and configuration, server roles, storage, Active Directory and Group Policy, file, print, and web services, remote access, virtualization, application servers, troubleshooting, performance, and reliability.
Learn more about:
» What is the Server?
» Server Roles.
» Server Hardware.
» Work groups & Domains.
» Device and printers.
» Windows Server OS Management tools.
Introduction to Linux OS, Linux file system hierarchy, Linux commands, Files permissions, Input-Output redirection, Environment variables, Process management, Linux shell scripting.
File is a container for storing information. It can be treated as a sequence of characters. Unlike the old DOS files, a UNIX file doesn‟t contain eof (end- of –file) mark. A file‟s size is not stored in the file, nor even its name. All files attributes are kept in separate area of hard disk, not accessible to humans, but only to the kernel.ThesisScientist.com
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
Tim Combridge from Sensible Giraffe and Salesforce Ben presents some important tips that all developers should know when dealing with Flows in Salesforce.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Strategies for Successful Data Migration Tools.pptxvarshanayak241
Data migration is a complex but essential task for organizations aiming to modernize their IT infrastructure and leverage new technologies. By understanding common challenges and implementing these strategies, businesses can achieve a successful migration with minimal disruption. Data Migration Tool like Ask On Data play a pivotal role in this journey, offering features that streamline the process, ensure data integrity, and maintain security. With the right approach and tools, organizations can turn the challenge of data migration into an opportunity for growth and innovation.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
2. Introduction to Linux
o Open source Operating System
o Developed by Linus Torvalds
o Architecture of Linux operating system
3. Linux Basic Commands:
o SYSTEM & HARDWARE INFORMATION
o USER INFORMATION AND MANAGEMENT
o FILE AND DIRECTORY COMMANDS
o PROCESS MANAGEMENT
o FILE PERMISSIONS
o NETWORKING
o ARCHIVES (TAR FILES)
o SEARCH
o FILE TRANSFERS
o DIRECTORY NAVIGATION
4. System & Hardware Information:-
o uname –a #Display Linux system information
Linux aa34faf8af0b 3.10.0514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
o uname –r #Dispaly kernel release information
3.10.0-514.26.2.el7.x86_64
o uptime #for how long system has been running
11:56:15 up 14 days, 21:18, 0 users, load average: 23.14, 24.23, 24.68
o hostname #gives hostname of the system
cb.vu
o hostname –I #gives IP address of the Host
78.31.70.238
o last reboot #to check when the system has been last rebooted
wtmp begins Sat Sep 9 10:24:23 2017
o date #display the date and time
Mon Jan 01 2018 17:17:33 GMT+0530 (India Standard Time)
o cal #display current month calendar
o free #Display the free and used memory (-h for human readable, -m for MB, -g for GB)
total used free shared buff/cache available
Mem: 263861664 11205028 205258364 1867876 47398272 233338992
Swap: 4194300 1756284 2438016
5. User Information and Management:-
o w #show who is logged in and what they are doing.
12:07:00 up 14 days, 21:29, 0 users, load average: 21.66, 24.14, 24.30
USER TTY LOGIN@ IDLE JCPU PCPU WHAT
o who #who is logged into the system
o whoami #who are you logged in as
[2018-01-01 17:41.43] ~
[SAGAR.workgroup] ➤ whoami
SAGAR
o id #display the current user id and group id
[2018-01-01 17:41.49] ~
[SAGAR.workgroup] ➤ id
uid=1001(SAGAR) gid=513(UsersGrp) groups=1002(HomeUsers),1004(ORA_DBA),559(Performance Log Users),545(Users)
o last #who logged in last
6. Files and Directories Commands:
o ls –al #lists all file in long listed format
o ll #actually aliased to `ls -l'
o pwd #shows present working directory
o mkdir directory_name #creates a new directory
o rmdir directory_name #deletes an empty directory
o rm –r directory_name #deletes the directory and its contents
o rm filename #deletes a file
o cp file1 file2 #copy one file to another
o mv file1 file2 #move a file/ rename a file
o touch filename #create a new file
o cat filename #displays the file contents
7. File Permissions:
• There are 3 types of users
1. User(u) 2. Group(g) 3. Others/ World(o)
• Below are the permissions types
• Read= r
• Write= w
• Execute = x
• No access = -
• Commands to change the permissions of the file:- chmod
example:- chmod 755 filename
1/0 1/0 1/0
r = - - -
w = - - -
x = - - -
Example: rwx rwx rwx chmod 777 filename
8. Archives (Tar files):
o tar -cf archive.tar directory # Create tar named archive.tar containing directory.
o tar -xf archive.tar # Extract the contents from archive.tar.
o tar -czf archive.tar.gz directory # Create a gzip compressed tar file name archive.tar.gz.
o tar -xzf archive.tar.gz # Extract a gzip compressed tar file.
Directory Navigation:
o cd .. # To go up one level of the directory tree. (Change into the parent directory.)
o cd # Go to the $HOME directory
o cd /etc # Change to the /etc directory
o cd - # go back to previous directory (last accessed dir)
9. Process Management:
o ps #your currently running processes
o ps –ef #all the currently running processes on the system
o ps- -ef |grep processname #process information for process name
o kill pid #kill a process
o top #display and manage the top processes
o killall processname #kill all processes named there
o program & #start program in the background
o bg #display stopped or background processes
o fg #bring the most recent backgroungd job to foreground
10. Networking:
o ifconfig #Displays network interface and ip address
o ping #to check given address is alive or not
o dig domain_name #display DNS information for domain
o dig –x IP_Address #Reverse lookup of IP_Address
o host domain #display DNS IP address for domain
o hostname #display the hostname
[2018-01-01 19:06.49] ~
[SAGAR.workgroup] ➤ hostname
workgroup
o netstat #Display listening tcp and udp ports and corresponding programs
[2018-01-01 19:11.20] ~
[SAGAR.workgroup] ➤ netstat
Active Connections
Proto Local Address Foreign Address State
TCP 10.10.156.9:4280 hk2sch130022025:https ESTABLISHED
TCP 10.10.156.9:4294 sb-in-f188:5228 ESTABLISHED
TCP 10.10.156.9:6010 static:https ESTABLISHED
TCP 10.10.156.9:9327 static:https ESTABLISHED
TCP 10.10.156.9:9635 13.75.42.223:https TIME_WAIT
11. SEARCH:
o grep pattern file # Search for pattern in file
o grep -r pattern directory # Search recursively for pattern in directory
o locate name # Find files and directories by name
o find /home/Dir -name 'prefix*’ # Find files in /home/Dir that start with "prefix".
o find /home -size +100M # Find files larger than 100MB in /home
File Transfer:
o scp file.txt server:/tmp # Secure copy file.txt to the /tmp folder on server
o scp server:/var/www/*.html /tmp # Copy *.html files from server to the local /tmp folder.
o scp -r server:/var/www /tmp # Copy all files and directories recursively from server
to the current system's /tmp folder.
12. File Editing:
o Most common editor in Linux -- vi editor
o Commands for editing files in vi editor
o vi filename # to open file in editor (Command mode)
o Press “i” # to go in INSERT mode
o double esc # moving to command mode
o :w #to save changes
o :q #to exit
o :q! #force exit
o :wq #save changes and exit
o Commands for movement inside a file
o h, j, k ,l #left, down, up
o $ #to end of a line
o ^ #to the beginning of a line
o G #end of a file
o :1 #to the beginning of a file
o :47 #to the given line (here on 47th line)
13. Editing file in vi editor
o dd #remove a line
o 5dd #remove 5 lines
o u #undo last action
o :s/string #searching a string in file
o :s/string/replace #search and replace a string in current line
o :%s/string/replace #search and replace a string in whole file
o :%s/string/replace/i #search and replace a string in whole file(Case Insensitive)
14. Introduction to PERL:
o PERL : Practical Extraction and Report Language
o Developed by Larry Wall in 1987
o It is a interpreted language
o Code written in Perl is called Perl Script
o Most recent version of Perl -Perl 5.24.3 released on 22-09-2017
15. Basic Syntax:
o Statements ends with semicolon (;)
o Comments starts with #
o Variables:
o You don’t have to declare a variable type
o Identifiers:
o A variable name
o Case Sensitive
16. o Example of perl Script :
#perl 5.22.1 ----------------- Perl version in comment
use strict; ----------------- Compiler flag for writing perl in strict way
use warnings; ----------------- Compiler flag for runtime warnings
print "Hello, World";-------------- Print statement for displaying output
Save this file with .pl extention (say – Hello.pl)
Execution of the Script : (on LINUX platform)
1. perl Hello.pl / perl –w Hello.perl
or
2. Make the perl file executable
chmod 700 Hello.pl
Execute with the following command:
./Hello.pl
17. Data types in Perl:
Perl language is a loosely typed language, the Perl interpreter itself chooses the data type
There are basically three data types in Perl
1. Scalars : Perl scalars are a single data item. A scalar can be a
number, a reference (address of a variable) or a string.
Scalars are preceded by ‘$’ sign.
Eg:- $name = “Sagar”;
$age = 24;
2. Arrays : Arrays are an ordered list of scalars.
They are preceded by ‘@’ sign.
Eg:- @arr = (1, 2, 3);
@arr_str = (“happy”, “new”, “year”);
3. Hashes : Hashes are an unordered collection of key-value pairs.
They are preceded by ‘%’ sign.
Eg:- %hashName = (
“Ram" => 24;
“Raman” => 26; );
18. User input in Perl Programming:
o For user input : <STDIN> or <>
Example : userInput.pl
#perl 5.22.1
use strict;
use warnings;
print "Enter your Name:n";
my $name = <STDIN>;
say "Welcome $name";
Execution: perl userInput.pl (Enter)
Output: Enter your Name:
Sagar
Welcome Sagar
19. String Operation Arithmetic
lt less than <
gt greater than >
eq equal to ==
le less than or equal to <=
ge greater than or equal to >=
ne not equal to !=
cmp compare, return 1, 0, -1 <=>
Comparison Operators:
20. Operator Operation
||, or logical or
&&, and logical and
!, not logical not
xor logical xor
Logical Operators
Operator Operation
. string concatenation
x string repetition
.= concatenation and assignment
$string1 = “Hello";
$string2 = “World";
$newstring = $string1 . $string2; #“HelloWorld"
$newerstring = $string1 x 2; #“Hello"
$string1 .= $string2; #“HelloWorld"
String Operators
21. Functions in Perl:
o Functions in Perl are known as Subroutines
o Subroutines are created with sub keyword
Example:
#!/usr/bin/perl
# Function definition
sub Hello {
print "Hello, World!n";
}
# Function call
Hello();
22. Predefined subroutines for Arrays:
Sr.No. Types & Description
1 push @ARRAY, LIST
Pushes the values of the list onto the end of the array.
2 pop @ARRAY
Pops off and returns the last value of the array.
3 shift @ARRAY
Shifts the first value of the array off and returns it, shortening the
array by 1 and moving everything down.
4 unshift @ARRAY, LIST
Prepends list to the front of the array, and returns the number of
elements in the new array.
23. Example for Arrays subroutines:
#perl 5.22.1
use strict;
use warnings;
my @arr;
print "Enter the number of element you want to enter n"; #Enter Size
my $n = <STDIN>;
print "n Enter the elements n"; # Enter Elements
for (my $i= 0; $i<$n; $i++){
my $ele = <STDIN>;
$arr[$i]=$ele;
}
print "Entered Elements are : --- n"; #print Elements
for (my $i= 0; $i<$n; $i++){
print $arr[$i];
}
print "Size of the array is : - ".scalar @arr."n"; # get Size
print "Your sorted array is : -n";
my @sorted_arr = sort(@arr); #sort Array
print @sorted_arr;
print "After Element pushingn";
push(@sorted_arr, "99n"); #add one Element at the end of array
print @sorted_arr;
print "New size of the array is :---".scalar @sorted_arr."n";
print "After unshifting ---- Adding element at begining n";
unshift (@sorted_arr,"555n"); #add element at the begining of the array
print @sorted_arr;
print "After poping ------ removing element from end n";
pop(@sorted_arr);
print @sorted_arr;
print "After shifting ------ removing element from beginning n";
shift(@sorted_arr);
print @sorted_arr;
OUTPUT:
Size of the array is : - 3
Your sorted array is : -
3
7
9
After Element pushing
3
7
9
99
New size of the array is :---4
After unshifting ---- Adding element at begining
555
3
7
9
99
After poping ------ removing element from end
555
3
7
9
After shifting ------ removing element from beginning
3
7
9
24. o File Handling :
Eg:
#perl 5.22.1
open(DATA, "<file.txt") or die "Couldn't open file file.txt, $!";
while(<DATA>) { print "$_"; }
o File opening modes:
Sr.No. Entities & Definition
1 < or r
Read Only Access
2 > or w
Creates, Writes, and Truncates
3 >> or a
Writes, Appends, and Creates
4 +< or r+
Reads and Writes
5 +> or w+
Reads, Writes, Creates, and Truncates
6 +>> or a+
Reads, Writes, Appends, and Creates
25. Regular Expression in Perl:
o There are three regular expression operator in Perl
1. Match Regular Expression - m//
2. Substitute Regular Expression - s///
3. Transliterate Regular Expression - tr///
Example: my $str = “Hello, World! Happy New Year ”;
Match operator : $str =~ m/Happy/ #true
Substitute operator: $str =~ s/World/India/; #will replace World with India(only first occurrence)
Translator operator: $str = ~tr/World/India/;#will replace all occurrence of World to India