preface 
 
  Look_up Engine  
 
  email how to  
 
  counter  
 
  regex  
 
  search engine  
 
  home  
 
  ask us  
 

 

Perl scripting


Applications


OO Perl


Perl & Databases


Search a word:
   



© The scientific sentence. 2010

Perl Split and substr functions
Split and substr functions


1. Split

The split function splits up a string and places it into an array. T Example: -------- $sentence= "Best regards and have a nice day .. "; @its_array = split(/a/, $sentence); ouputs: Best regards and have a nice day .. We cam also write: $_= "Best regards and have a nice day .. "; @its_array = split(/a/);

2. substr

To substring, as an example, we can use the followinigs: $sentence= "Best regards and have a nice day .. "; substr($sentence, 2, 6); (from 3d to 6th character from the 3d) returns "st reg" substr($sentence, 5); (from the 5th to the end of the sentence) returns "regards and have a nice day .. " substr($sentence, -9, 4); (from 9th from the end and the 4th from the 9th) returns "e da"
  
Google
Web
ScientificSentence
 




chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2007. All rights reserved.