神奇的Perl-哈希和数组(7)

声明:本神奇的Perl系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载

1.1          push、pop、shift、unshift

1、push在数组末尾处增加元素,pop就是从数组的末尾取出元素。具体语法如下:

push ARRAY, (以逗号分隔的要增加的值列表)
   
push ARRAY,
要增加的值

 

pop ARRAY

比如:

my @myarr;

push @myarr,-1;

push @myarr,0;

push @myarr,1;

print pop @myarr;

print "\n";

print pop @myarr;

print "\n";

print pop @myarr;

print "\n";

 

 

 

输出如下 :

1

0

-1

 

2、unshift在数据的起始增加元素,shift在数组的起始取出一个元素。shift弹出数组的值,并返回它,unshift的队列中增加值。具体语法如下:

unshift (ARRAY,(以逗号分隔的要增加的值列表))

unshift ARRAY,要增加的值

 

shift ARRAY

比如:

    

 

 输出如下:

1

0

-1

3、通过对push、pop、shift、unshift使用组合,可以实现堆栈和队列的操作。

1)堆栈,后进先出,通过push和shift组合实现

my @myarr;

push @myarr,-1;

push @myarr,0;

push @myarr,1;

print pop @myarr;

print "\n";

print pop @myarr;

print "\n";

print pop @myarr;

print "\n"; 

 

 

 

输出如下:

1

0

-1

2)队列,先进先出,通过push和shift组合实现

my @myarr;

 

push @myarr,-1;

push @myarr,0;

push @myarr,1;

print shift @myarr;

print "\n";

print shift @myarr;

print "\n";

print shift @myarr;

print "\n";

 

 

 

 

输出如下:

-1

0

1

 

1.2         第四个任务

BOSS要求编写一个脚本,搜索某目录下所有以PHP扩展名结尾的源代码文件,并生成一个HTML文件,其内容是按目录归类的文件列表。

我们先简单介绍一下如何操作目录及文件:

通常使用opendir、closedir 、readdir函数操作目录,格式如下:

opendir(DH, $some_dir) || die "can't opendir $some_dir: $!";
#opendir打开目录,将目录句柄赋值给DH。$some_dir为要打开的目录名。
#开始循环读取目录下的文件
    foreach  $file(readdir DH){#读取目录下的文件,readdir返回文件列表
       if ( -d $file){
            # -d 文件名称 检测$file储存的文件名称是否为目录。
           #$file是子目录,对子目录进行处理
      }
      else {
        #$file是文件,对文件进行处理。
      }
  }
  closedir DH;#关闭目录句柄
 
我们的思路是:
1)    打开要读取的目录。
2)    循环读取目录中所有文件,将新发现的子目录存储在数组中。
3)    继续取出数组中的目录,如果数组中没有元素,转到第4步,否则转到第1步。
4)    退出。
存放目录的数组采用堆栈的方式操作,可模拟深度优先搜索,较好地展示目录树结构。代码如下:

 

 

 

#perl3-8.pl
use 5.010;

use warnings;

use strict;

my $dirs='E:\TDDOWNLOAD\latest';# 初始路径

my $lsfile;

my @filedir;

my %filediryj;#已经访问过的目录 ,哈希键值对为:目录名=>文件数目

my $flcount;

my $ppfile;#文件匹配符 以正则方式表达的

open MYTXT,">phpfiles.htm";

#输出HTML文件头

say MYTXT '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';

say MYTXT '<html xmlns="http://www.w3.org/1999/xhtml">   ';

say MYTXT '<head> ';

say MYTXT '<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />   ';

say MYTXT '<title>查找某目录下的某类文件</title>  ';

say MYTXT '</head> ';

say MYTXT '<body> ';

 

 

$ppfile='php$'; #要寻找文件扩展名为php,php后紧跟符号$表示文件名以php结尾。

push @filedir,$dirs;

$|=1;

my $filedir;

while ($filedir=shift(@filedir)){

   opendir DH,$filedir or die "不能打开$filedir"; #打开目录

   say MYTXT "<br>$filedir<br>";

   $flcount=0;

   foreach $lsfile(readdir DH){#读取目录

      #变量名=~m/正则表达式/ 表示对变量进行正则表达式匹配,

      #如果匹配成功,则返回真,否则返回假

      next if $lsfile=~m/^\./;#~m/^\./对$lsfile进行正则表达式匹配,^\.表示以点号开头

      # .和..均以点号开头,分别表示当前路径和上一路径,它们不属于子目录和文件。

      $lsfile="$filedir\\$lsfile";#”\”有特殊意义,因此必须以\\表示符号\

      if ( -d $lsfile){

         push @filedir,$lsfile;

      }

      elsif ($lsfile=~m/$ppfile/i) {

         $flcount++;

         print '.'; #在屏幕上输出进度

         say MYTXT "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|$lsfile<br>";#匹配文件名写入HTML文件的body部分

      }

  }

  close DH;

  $filediryj{$filedir}=$flcount;#目录下匹配文件数目 

  say MYTXT "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|共$flcount个匹配文件<br>";

}

#输出HTML文件尾

say MYTXT '</body>  ';

say MYTXT '</html>  ';

 

Perl文本处理实战:从环境搭建到日志分析,掌握系统管理利器 正则表达式是文本处理的核心技术之一,它通过定义模式匹配规则,实现对字符串的高效搜索、替换和提取。其原理基于有限自动机理论,能够快速在海量数据中定位特定模式。这项技术在数据处理、日志分析和系统运维中具有极高价值,尤其在处理非结构化文本时展现出强大优势。Perl语言将正则表达式深度集成到语法层面,提供了简洁而强大的原生支持,使其成为文本处理领域的经典工具。结合哈希数据结构,Perl能够轻松实现数据聚合与统计,这在日志分析和系统监控场景中尤为实用。本文通过实际案例,展示如何运用Perl的正则表达式和哈希功能快速分 阅读详情

相关推荐

精通Perl编程与Perl CGI应用合集

Perl使用sub关键字定义子程序(函数)。

weixin_42608299的博客 718

Perl语言入门笔记 第六章 哈希(hash)

=pod 哈希 哈希表里只是一堆的键值对而已,而没有任何顺序,键可以是任意字符串,值也是 awk的哈希键值对增多的时候会逐渐变慢,而perl没有这个缺点 访问哈希元素: $hash{$some_key} foreach my $person (qw< barney fred >) { print "I'v ...

dietan8353的博客 406

零基础学习大气污染模式(WRF、WRF-chem、smoke、camx等)

零基础学习大气污染模式(WRF、WRF-chem、smoke、camx等)

weixin_56135535的博客 655

数组 链表 哈希表 区别详解

一、数组 1、简介 数组将元素在内存中连续存放,存储区间是连续的。 2、举例 体育课上,老师说:同学们站一队,每个人记住自己是第几个,我喊到几,那个人就举手,这就是数组。 3、优缺点 1.数组必须事先定义固定的长度,不能适应数据动态的增减的情况。当数据增加时,可能超出原先定义的元素个数;当数据减少时,造成内存浪费。 2.数组从栈中分配空间,对于程序员方便快速,但是自由度小。 3.当进行数据查询时,数组可以直接通过下标迅速访问数组中的元素。 4.当进行增加或删除元素时,在数组中增加一个元素,

weixin_43240792的博客 4073

Multisim14.0仿真实战:从零搭建RS/JK触发器电路(附真值表+波形图)

本文通过Multisim 14.0软件,提供了从零搭建RS触发器和JK触发器电路的详细仿真实战教程。内容涵盖核心概念解析、电路搭建步骤、动态波形观测及真值表分析,重点探讨了RS触发器的非法状态问题以及JK触发器的四种工作模式,帮助读者直观理解时序逻辑电路的“记忆”功能与设计要点。

weixin_29175469的博客 275

DeepSeek-OCR又更新:一起看下OCR1和OCR2

DeepSeek-AI 最近又又开源了,这次是DeepSeek-OCR2,结合之前发布的DeepSeek-OCR ,可以发现DeepSeek走出了一条不同于主流 OCR 方案的技术路线。第一代模型探索了**“视觉作为文本压缩介质”的可行性,打破了传统的序列长度限制;第二代模型则通过“Visual Causal Flow(视觉因果流)”**架构,将因果推理引入视觉编码器,解决了复杂排版下的阅读顺序难题。本文将从架构设计、逻辑结构、训练范式及工程实现四个维度,深度剖析这两代模型的异同与创新。

kakaZhui的博客 624

hash表与数组

hash表 hash表的查找/插入/删除的时间复杂度均为o(1), (因为hash表本身是一个数组,查找o(1), 而插入/删除时,根据hash值直接插入/删除) 数组的插入/删除需要移动元素,送、so,,,,,,,,其时间复杂度为O(n), 查找时根据index直接查找,时间复杂度均为o(1), hash表的插入/删除本质上属于是属于赋值/替换操作,因此时间复杂度均为o(1),不需移动...

Mar.三月 3429

Voronoi算法构建多晶

孪晶多晶 采用孪晶的原子链作为种子通过voronoi算法可以得到孪晶多晶结构。 孪晶种子: txt文件不需要特殊设置 box 150 150 150 random 8 得到孪晶多晶: 通过改变孪晶种子的长度可以得到不同孪晶片层厚度的多晶。 准二维柱晶 所有晶粒在某一维度的晶向一致,晶粒仅在平面内具有旋转关系,所有晶界为旋转对称晶界,这种结构的多晶其位错滑移在某些方向受限,但是能极大的提高晶粒...

yamatachi的博客 5280

神奇的Perl-哈希与数组(2)

声明:本神奇的Perl系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载 1.1         哈希内插哈希 很多情况下,需要几层哈希来存储一个数据表,比如以下学生成绩表: 姓名 物理 化学 数学 张三 85 79 90 ...

深未来技术 403

单细胞分析R包monocle3服务器安装教程

由于centos7系统yum只能安装到低版本gdal,而monocle3依赖包需要 gdal>2 版本,从gdal官网下载2.4.4版本编译安装。monocle3的安装是通过cole-trapnell-lab安装的,该包挂在github上,需要通过github先安装leidenbase包,需要提前安装devtools包下载工具。接着利用BiocManager安装相应的依赖包,由于这些包的特殊性,所以不要切换到国内Bio_Mirror镜像,否则会找不到,如果一次不成功,缺啥补啥即可。运行 ldconfig。

qq_36608036的博客 1万+

[SVA]SystemVerilog Assertion Property开发技巧总结

SystemVerilog Assertion开发技巧总结 一、在property中可以使用if-else条件语句 如下面的例子,根据misc_phy_12g_rx的取值,选择不同的判断语句 property ck1_en_rose_chk(); @(posedge clk) disable iff(~rst_n) ad_pn_ck1en & (current_state !== ST_IDLE) |->...

元直的博客 5924

神奇的Perl-哈希与数组

声明:本神奇的Perl系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载 1.    哈希内嵌数组 语法格式如下: 声明及定义 my %哈希变量=( 哈希键1=>[数组元素1,数组元素2,…,数组元素n]

skly01的专栏 4921

【机器学习系列】一文搞懂 零知识机器学习(zkML)

位串行乘法器:实现了Booth编码优化,将乘法分解为移位-加法序列,减少部分积数量50%:模拟脉动阵列的2D网格计算,支持分块(tiling)策略优化内存层次卷积映射:提供直接卷积(行缓冲+滑动窗口)和im2col+GEMM两种硬件映射策略。

VectorShift的博客 158

神奇的Perl-哈希和数组(6)

声明:本神奇的Perl系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载 1.1.1 each、values、keys、sort 1、 each each一般作用于哈希和数组,以2元素的列表形式返回哈希的键值对和数组的索引、值对。语法如下:    each %hash each @array 比如:  while...

深未来技术 191

若依框架二次开发——RuoYi-AI 本地部署流程

若依框架二次开发——RuoYi-AI 本地部署流程

bjzhang75的博客 1787

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

神奇的Perl-哈希与数组(3)

声明:本神奇的Perl系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载 1.     哈希内嵌数组 语法格式如下: 声明及定义 my %哈希变量=( 哈希键1=&gt;[数组元素1,数组元素2,…,数组元素n], 哈希键2=&gt; [数组元素1,数组元素2,…,数组元素n], ….. …… 哈希键n=&g...

深未来技术 173

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

神奇的perl-哈希和数组(5)

声明:本神奇的Perl系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载 1.1         第三个任务 BOSS交给小张一个文本文件,为去年销售人员季度完成的销售额,要求小张统计出前三名做为金牌销售员人选。 张三 25  9   10  60 李四 17  16  79  25 黄三 5  10  5   2 黄...

深未来技术 179

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

神奇的Perl-哈希与数组(8)

声明:本神奇的Perl系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载 1.     数组内嵌数组 1、 声明及定义 首先,定义内嵌的数组 my  @内嵌数组1=(元素1,元素2,元素3,…,元素n); my  @内嵌数组2=(元素1,元素2,元素3,…,元素n); …… 接着,使用“\”来创建内嵌的数组的引用,以...

深未来技术 146

Perl简介

同样执行命令 run.pl ./file.txt,此时钻石操作符表示 “ 将文件 file.txt 中的所有行都读进来,保存成一个列表,列表的每个元素就是文件中的每一行内容,让后用 foreach 遍历这个列表 ”然后执行命令 run.pl ./file.txt,此时脚本中的钻石操作符表示 “每次从文件 file.txt 中读取一行,然后执行打印,接着读取下一行,再打印,直到读完最后一行,退出循环 ”而在 foreach 语句中,是列表上下文,所以这时直接从文件中取出所有的行,组成一个列表。

weixin_48518726的博客 625

Perl的学习笔记--基本语法

说明Perl 最初的设计者为 Larry Wall,Perl 借取了 C、sed、awk、shell scripting 以及很多其他程序语言的特性。 Perl 一般被称为 “ 实用报表提取语言” (PracticalExtraction andReportLanguage),有时也被称做“ 病态折中垃圾列表器”(PathologicallyEclectic Rubbish Lister) 。资料...

芸灵fly的博客 414

神奇的Perl-第六个任务(5)

本神奇的Perl系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载 1.1         跨平台运行 Perl程序虽然可以跨平台运行,但编写出可移值的代码需要很多技巧,在此仅列举部分技巧。 1.1.1 执行程序 1、            WINDOWS平台下,Perl一般运行在控制台,如果想更稳定运行,建议安装...

深未来技术 152

面向对象的perl 3

面向对象的perl 3如何使用instance variabl实例变量什么是实例变量, 实例变量就是和实例关联的变量。 不同的对象的实例变量是在不同的namespace里的,就是说是互无关系的, 是私有财产。与其相对的是类变量,她是公有的。说到这里要提一下前面一节中提到的构造器。在前面提到的所有的构造器中,我们都用了一个匿名哈西作为bless的参数,是否哈西有什么神奇的地方呢?

wti的专栏 2630

Perl 的继承

Perl 类的定义 Perl的一个packag可以作为一个类使用,文件后缀名为.pm,并且把package里的函数当作类的方法来用。如: package Person; 创建和使用对象 大多数程序使用类名作为构造函数,Perl 中可以使用任何名字。 你可以使用多种 Perl 的变量作为 Perl 的对象。大多数情况下我们会使用引用数组或哈希。 接下来我们为 Perso...

weixin_30466421的博客 193

Perl语言入门

Perl,以其文本处理的神奇能力和灵活多变的语法而在编程世界中独领风骚。它是一门强大而实用的脚本语言,由Larry Wall于1987年创造。在这篇文章中,我们将深入研究Perl的各个方面,带你一步步领略这门富有表达力的编程语言。

m0_61394395的博客 217

perl php,观点|PHP十年前灭掉Perl,如今也将面临危机

本文来源于国外一位博友的文章,他在博客中写道:“是到了PHP落幕的时候了。就在我这个顽固的PHP分子正要把一个现有的Ruby on Rails代码库转换成PHP时,我要说这样的话”。历史在重演作者认为PHP将亡,因为我以前见到过。大概十年之前,PHP灭掉了Perl。当然了,并不十分彻底;它还坚守在某些环境里,它还有相当可观数量的顽固粉丝,遗留下来的应用程序也需要维护,持续几十年。但这种语言对于新一...

weixin_33148993的博客 241
上一篇: 神奇的Perl-哈希和数组(6)
下一篇: flex游戏引擎(PushButton)-控制输入(1)
deepfuture
博客等级 码龄17年 211粉丝 1287原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值