Use of uninitialized value in pattern match - perl
I want to strip the process name from the hosts - i did it with the code below.
I have two questions - is there a more compact way to strip off the process names? usalso i want to get rid of the errors after extracting the hostname. It is complaing about $arry[1]. using my $arry[1] is not allowed. Assigning the slice to a value, as is 'my $sliced_arry = $arry[1]; print $sliced_arry , does not work either. Code:
Code:
#!/usr/bin/perl -w |
For starters, you didn't give us info what line #7 is.
I suggest to cat -n your_file.pl and copy-paste screen output of the above here. ... Read carefully 'perdoc -f split' - near the end. Check values of '@arry'. Consider using "split(' ', $whatever)" instead of "split(/\s+/, $whatever)" - you practically never need the latter (I don't remember such a case in my life). |
thank you i am reading it now
|
Quote:
Code:
split(' ', $whatever); |
I read the perl doc's for split, and ended up traversing the array with a for each loop - use strict seems to like that.
no more errors. Code:
#!/usr/bin/perl -w |
All times are GMT -5. The time now is 02:29 PM. |