Perl Array delimiter
Hello Friends,
I am learning Perl in Linux these days. I have the following code which prints the array using delimiter as "\n"(new line). Code:
#!/usr/bin/perl Code:
print @me; What is that? |
You are not using "\n" as a delimiter.
You are processing each element of an array and printing "\n" after the element to throw a new line. You would need to modify each element to include the newline, which is far more complex than what you are currently doing: Code:
#!/usr/bin/perl |
Disillusionist,
I think we both did same thing(you appended \n for each element and then retrieved the array, I printed each element of array followed by \n).Indeed, you are changing my array entirely. My concern is all about to print the array with some delimiter without actually changing my array. |
Code:
perl -E' Code:
perl -le' Code:
perl -le' Code:
perl -e' |
my suggestion, before you digest and use the solutions here, is to re-read the Perl documentation and get your basics right.
perldoc perl, perldoc perltoc or perldoc perlintro is what you need right now. |
Thank you radoulov, :)
This is what exactly I want. ghostdog74, How can I get "perldoc perl, perldoc perltoc or perldoc perlintro"? Did you mean to download them from the links you put in your signature?Anyway, thanks for your suggestion. |
Quote:
Quote:
|
Quote:
@Ashok.g, I highly recommend this article for reviewing Perl's special variables. It specifically discusses what you're trying to do: http://www.perl.com/pub/a/2004/06/18/variables.html |
Quote:
|
All times are GMT -5. The time now is 05:42 PM. |