in reply to Re: using system command in regex
in thread using system command in regex
Thanks for reply. Now I know how chomp working in my above program. I write (extended) my program in another way. Here as you said I used (\s+) instead of "\s".
my $SMPP_count = int ((split (/\s+/,`cut -d "|" -f 1,10,13 SMSCDR*$date$hour$minute*.log |grep "Submit|GSM" |grep "$hour:$min:$sec" |sort |uniq -c`)) [1]) + int ((split (/\s+/,`cut -d "|" -f 1,10,13 SMSCDR*$date$hour$minute*.log |grep "Submit|SMPP" |grep "$hour:$min:$sec" |sort |uniq -c`)) [1]);Here the array returning by split contains "NULL" in the 0th position. If you write "(split ..., ...)[0]" its giving the result like
Use of uninitialized value in int at second.pl line 34. 06:20:00= 0 0 Argument "" isn't numeric in int at second.pl line 34. Argument "" isn't numeric in int at second.pl line 34. 06:20:01= 0 0 Argument "" isn't numeric in int at second.pl line 34. Argument "" isn't numeric in int at second.pl line 34. 06:20:02= 0 0 Argument "" isn't numeric in int at second.pl line 34. Argument "" isn't numeric in int at second.pl line 34. 06:20:03= 0 0 Argument "" isn't numeric in int at second.pl line 34. Argument "" isn't numeric in int at second.pl line 34. 06:20:04= 0 0 Argument "" isn't numeric in int at second.pl line 34. Argument "" isn't numeric in int at second.pl line 34. 06:20:05= 0 0
Why the first element in the array is "NULL"????
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: using system command in regex
by shmem (Chancellor) on Oct 13, 2015 at 12:34 UTC | |
by ravi45722 (Pilgrim) on Oct 14, 2015 at 05:46 UTC | |
by shmem (Chancellor) on Oct 15, 2015 at 07:51 UTC | |
by ravi45722 (Pilgrim) on Oct 15, 2015 at 10:41 UTC | |
by marto (Cardinal) on Oct 15, 2015 at 10:47 UTC | |
by shmem (Chancellor) on Oct 15, 2015 at 12:24 UTC | |
| |
by soonix (Chancellor) on Oct 15, 2015 at 14:48 UTC | |
| |
by shmem (Chancellor) on Oct 14, 2015 at 17:48 UTC | |
by ravi45722 (Pilgrim) on Oct 15, 2015 at 04:08 UTC | |
|
Re^3: using system command in regex
by AppleFritter (Vicar) on Oct 13, 2015 at 12:07 UTC | |
by ravi45722 (Pilgrim) on Oct 13, 2015 at 13:09 UTC |