|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Hi all.
I have a text fiel which contains File Type1:Word Number of Files1: 5 Size of file1: 50kb Time1: 1Hr File Type2:text Number of Files2: 10 Size of file2: 50mb Time2: 30min now i have to retrive only Word,5,50Kb,1Hr,text,10,50mb,30min...from this text file. This values keeps chaning. How can i do this using perl. Help me out. |
|
#2
|
||||
|
||||
|
You can do this using a regular expression:
Code:
if ($line =~ /:(.*)/) {
$val = $1;
}
or using index() function: Code:
$pos = index($line, ":");
if ($pos > -1) {
$val = substr($line, $pos + 1);
}
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Reg Expression |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|