Search Results

Search: Posts Made By: zx1106
3,938
Posted By zx1106
Perl Diamond Operator
I know that when using 'while (<FILE>) {}', Perl reads only one line of the file at one time, and store it in '$_'.

Can I change some parameters so that 'while (<>) {}' can read more than one...
3,949
Posted By zx1106
Searching array of arrays in perl
Suppose there are two arrays of arrays:

@A = ( [A, 1], [B, 3], [C, 4], [D, 6] );
@B = ( [A, 2], [B, 5], [C, 3], [A, 3], [E, 7] );

For each of $A[0][0], $A[1][0], $A[2][0]..., I want to find...
1,982
Posted By zx1106
What about the second order: qw(a1 a2 a12 b2 b4...
What about the second order:
qw(a1 a2 a12 b2 b4 b22 cd1 ef hij);
Thanks!
1,982
Posted By zx1106
Thanks! It works for the first order.
Thanks! It works for the first order.
1,982
Posted By zx1106
[B]Perl sort quick question[/B]
I've done a quick Google about this, but could not find the answer I want.

Say, there is an array like this:
@A = qw(cd1 a1 ef a2 hij a12 b2 b4 b22);

I want to sort the array in the first...
Forum: Programming 10-03-2008
6,050
Posted By zx1106
Most are scientific programming and text...
Most are scientific programming and text processing.
Forum: Programming 10-03-2008
6,050
Posted By zx1106
Thanks for your suggestion! I just bought C...
Thanks for your suggestion! I just bought C Programming Language 2nd ed. (Prentice Hall), do you think that should be enough? I am just wondering if I also need to get a reference book. By the way I...
Forum: Programming 10-03-2008
6,050
Posted By zx1106
C Reference Book
Hi All,

Which one do you think is better as the C reference book: C in a Nutshell (O'Reilly, 2005) or C Primer Plus 5th ed. (Sams, 2004)?

I knew both of them should be great, but I certainly...
4,385
Posted By zx1106
Thanks! I tried 'grep' like this before, but it...
Thanks! I tried 'grep' like this before, but it will also give you those strings '******' after the name 'AB_21423'. Is there a way I can only store the name? Many thanks!
4,385
Posted By zx1106
Matching in bash script
I know how to do this in perl, but I want to do it in bash script. Hope some one could help me, many thanks!

I have a file looks like this:

AB_21423 *********
BC_123 *********...
2,383
Posted By zx1106
No, it is not. But I finally figure out I can use...
No, it is not. But I finally figure out I can use "goto" instead of "redo" just now.
Thanks for help!
2,383
Posted By zx1106
Sorry I should make this more clear. Thanks to...
Sorry I should make this more clear. Thanks to era and KevinADC for help.

The question I tried to solve equals to:
Randomly divide a 5500 feet rope into 10 pieces, and the length of every piece...
2,383
Posted By zx1106
[B]"redo" in perl[/B]
I knew this would not work because of problem with "redo". Is there a way to fix this? Thanks a lot!


my @n = (10..100);
my $i;
my $j = 0;
my $k;

LINE1: for ($i; $i < 10; $i++) {
$k =...
9,828
Posted By zx1106
Thanks a lot!
Thanks a lot!
9,828
Posted By zx1106
generate random number in perl
Could any one tell how can I generate random number from (0, 100..200) in perl?

Thanks!
18,911
Posted By zx1106
Could you give more details? Thanks!
Could you give more details? Thanks!
18,911
Posted By zx1106
Sorry, I should make my question more clear. So...
Sorry, I should make my question more clear. So here is an example.

AAA
BBBBBBBBBB
CCCCCCCCCC
DDDDDDDDD
EEEEEEEEEEE

The file contains five lines, one way to process this by using while (<>)...
18,911
Posted By zx1106
read and match multiple lines in perl
Could any one tell me how to read and match multiple lines in perl? Did this code below still work in this situation?

while (<FILE>) {
if (/ /) {
}
}

Thanks a lot!
4,894
Posted By zx1106
Problem solved! Thanks so much!
Problem solved! Thanks so much!
4,894
Posted By zx1106
Thanks! This certainly works, but you have to...
Thanks! This certainly works, but you have to type every time. So there is probably a way you do not need to type while can finish this?
4,894
Posted By zx1106
Thanks a lot! I tried this method before,...
Thanks a lot!

I tried this method before, but how could I do if I want to change a file among *.txt to *.exe (keep the first part while change the second part)?

Thanks!
4,894
Posted By zx1106
one question for bash shell script
Just one question for bash shell script.
In bash script, you can use *.txt to call any files in current folder that ends with .txt, like
rm *.txt
will remove all txt file in current folder.

My...
Showing results 1 to 22 of 22

 
All times are GMT -4. The time now is 09:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy