![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Split Command in Perl | rochitsharma | UNIX for Advanced & Expert Users | 9 | 03-09-2008 03:56 AM |
| split to array in perl | jaganadh | Shell Programming and Scripting | 3 | 07-06-2007 05:29 AM |
| multiple pattern split in perl | umen | Shell Programming and Scripting | 3 | 08-01-2006 02:43 AM |
| split question perl | reggiej | Shell Programming and Scripting | 7 | 07-21-2006 04:18 PM |
| perl split function | new2ss | Shell Programming and Scripting | 5 | 06-08-2006 10:17 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Perl Split Command usage
Hi,
I am trying to use the split commad to seperate string reading from file. but it dosent give me a correct result. can some body tell me what is the wrong in following scritp. Code:
#!/usr/bin/perl -w
#use CGI qw(:standard);
#use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;
open(FH,"bh_file.txt");
while (my $line = <FH>) {
my @hash_array = split(/|/, $line);
print $hash_array[1] ;
}
close(FH);
Code:
Banikoara_A1|0|2006-12-14 19:00|duration: 120 minute(s)| 0.24 0.13 Banikoara_B1|1|2006-12-14 19:00|duration: 120 minute(s)| 0.08 0.08 my expected output should be, Banikoara_A1 Banikoara_B1 (print the 1st column) current out put as follows, aa |
| Bookmarks |
| Tags |
| delimited, perl split |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|