-
Notifications
You must be signed in to change notification settings - Fork 580
Problem with list ... #3306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From [email protected]I want to break a long string in "file" to give me "file2" as output. ### Start To my surprise simply print "@array[1..10]"; were giving me the whole file NOT only 10 characters. Whether I am doing wrong or a BUG in perl? Perl Info
|
From [Unknown Contact. See original ticket]On 28 Jan 01, at 19:53, u99103@cs.unipune.ernet.in wrote:
You appear to be misunderstanding some things about Perl. I'll go through your code:
This reads in the contents of "file", putting each line into a separate
Sets $i to 0.
This does not compile for me at all. It gives me the warning "Can't It calculates $i * 70 (which is 0 * 70 = 0, since you just set $i to 0)
This assigns elements from $i to $i+70 to @temp. If $i is 0, then @temp
And this prints the lines in @temp to file "file2" separated by $",
This prints array elements from 1 to 10 (10 elements total), separated
Since "1..10" is in scalar context here, it's the "flip-flop" operator,
If you read from the file with @array = <fd>, then each element of If you want to have characters, you probably want something like If you can describe in more detail what it is exactly you are trying to Cheers, |
Migrated from rt.perl.org#5538 (status was 'resolved')
Searchable as RT5538$
The text was updated successfully, but these errors were encountered: