如何 运行 来自 .txt 文件?
How to Run From .txt File?
我正在尝试通过附加到字符串末尾来从 base58 组合中获取数据。
#!c:\perl64\bin\perl.exe
{$db = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
$pw="Rw5cfDTA8zGsdjEhKnhXJTH7LrciGrDi9qZ1";
@delen = split('',$pw);
@letters = split('',$db);
$length = length($pw);
for ($position = 36; $position < $length+1; $position++)
{foreach(@letters)
{
@new = @delen;
splice(@new, $position, 0, $_);
print join('',@new)."\n";
}}}
我必须在 $ pw 定义中一一输入所有组合。我希望它能够处理 TXT 文件中列表的所有行,而不是手动输入。我做了一些关于如何做的研究但失败了。
编辑中:
我找到了我上面说的方法,完全就是这样。但是,我有一个不同的问题。当我 运行 Perl 文件时,输出顺序很糟糕。我认为从输入文件中获取有问题
#!c:\perl64\bin\perl.exe
open( my $data, "<", "test.txt" ) or die "There was a problem opening: $!";
while ($data) {
{
my $db = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
my $pw = <$data>;
my @delen = split( '', $pw );
my @letters = split( '', $db );
my $length = length($pw);
for ( my $position = 35 ; $position < $length + 1 ; $position++ ) {
foreach (@letters) {
my @new = @delen;
splice( @new, $position, 45, $_ );
print join( '', @new ) . "\n";
}
}
}
}
#决赛
经过长期的努力,我得到了我想要的结果。这对我来说完美无缺。
#!c:\perl64\bin\perl.exe
open( my $data, "<", "4.txt" ) or die "There was a problem opening: $!";
while ($data) {
{
my $db = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
my $pw = <$data>;
my @delen = split( ' ', $pw );
my @letters = split( '', $db );
my $length = length($pw);
for ( my $position = 39 ; $position < $length + 1 ; $position++ ) {
foreach (@letters) {
my @new = @delen;
splice( @new, $position, 0, $_ );
print join('', @new ) . "\n";
}
}
}
}
#决赛 2
现在已经脱离循环了。
唯一的错误是:splice() offset past end of array at
#!c:\perl64\bin\perl.exe
use strict;
use warnings;
open( my $data, "<", "file_in.txt" ) or die "There was a problem opening: $!";
while (my $pw = <$data>) {
my $db = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
my @delen = split( ' ', $pw );
my @letters = split( '', $db );
my $length = length($pw);
for ( my $position = 38 ; #line break
$position < $length + 1 ; $position++ ) {
foreach (@letters) {
my @new = @delen;
splice( @new, $position, 0, $_ );
print join('', @new ) . "\n";
}
}
}
close $data;
我正在尝试通过附加到字符串末尾来从 base58 组合中获取数据。
#!c:\perl64\bin\perl.exe
{$db = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
$pw="Rw5cfDTA8zGsdjEhKnhXJTH7LrciGrDi9qZ1";
@delen = split('',$pw);
@letters = split('',$db);
$length = length($pw);
for ($position = 36; $position < $length+1; $position++)
{foreach(@letters)
{
@new = @delen;
splice(@new, $position, 0, $_);
print join('',@new)."\n";
}}}
我必须在 $ pw 定义中一一输入所有组合。我希望它能够处理 TXT 文件中列表的所有行,而不是手动输入。我做了一些关于如何做的研究但失败了。
编辑中:
我找到了我上面说的方法,完全就是这样。但是,我有一个不同的问题。当我 运行 Perl 文件时,输出顺序很糟糕。我认为从输入文件中获取有问题
#!c:\perl64\bin\perl.exe
open( my $data, "<", "test.txt" ) or die "There was a problem opening: $!";
while ($data) {
{
my $db = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
my $pw = <$data>;
my @delen = split( '', $pw );
my @letters = split( '', $db );
my $length = length($pw);
for ( my $position = 35 ; $position < $length + 1 ; $position++ ) {
foreach (@letters) {
my @new = @delen;
splice( @new, $position, 45, $_ );
print join( '', @new ) . "\n";
}
}
}
}
#决赛
经过长期的努力,我得到了我想要的结果。这对我来说完美无缺。
#!c:\perl64\bin\perl.exe
open( my $data, "<", "4.txt" ) or die "There was a problem opening: $!";
while ($data) {
{
my $db = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
my $pw = <$data>;
my @delen = split( ' ', $pw );
my @letters = split( '', $db );
my $length = length($pw);
for ( my $position = 39 ; $position < $length + 1 ; $position++ ) {
foreach (@letters) {
my @new = @delen;
splice( @new, $position, 0, $_ );
print join('', @new ) . "\n";
}
}
}
}
#决赛 2
现在已经脱离循环了。
唯一的错误是:splice() offset past end of array at
#!c:\perl64\bin\perl.exe
use strict;
use warnings;
open( my $data, "<", "file_in.txt" ) or die "There was a problem opening: $!";
while (my $pw = <$data>) {
my $db = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
my @delen = split( ' ', $pw );
my @letters = split( '', $db );
my $length = length($pw);
for ( my $position = 38 ; #line break
$position < $length + 1 ; $position++ ) {
foreach (@letters) {
my @new = @delen;
splice( @new, $position, 0, $_ );
print join('', @new ) . "\n";
}
}
}
close $data;