#!/usr/bin/perl -w

 use strict;
use warnings; $_='She is a good girl
and likes helping others
'; s/she/he/i;print "$_"; #he is a good girl
#and likes helping others s/hae/she/i;print "$_"; #he is a good girl
#and likes helping others s/(he)/$@ @/i;print; #he@ @ is a good girl
#and likes helping others s/s$/ours,/m;print; #he@ @ is a good girl
#and likes helping otherours, s/(\w*)ing/$/g;print; #he@ @ is a good girl
#and likes help otherours, $_ ='homeN home ome ooo
'; s/h/i/;print; #iomeN home ome ooo s/o/g/g;print; #igmeN hgme gme ggg s(gme)()g;print; #i123N h123 123 ggg s(n)(pppp)i;print; #i123pppp h123 123 ggg (my $copy = $_) =~ s/\s/__/g;print "$copy$_"; #i123pppp h12__12__ggg
#i123pppp h123 123 ggg #my $copy = $_ =~ s/3\s/__/g;print "$copy$_"; #i123pppp h123 123 ggg
#2i123pppp h12__12__ggg s/(\w*)/\U$/gi;print; #I123PPPP H123 123 GGG s/(\w*)\s(\w*)/\l$/i;print; #i123PPPP 123 GGG s/(GGG)/\u\L$/gi;print; #i123PPPP 123 spGgg print "\u\Lmy name is \Uyy\n"; #My name is YY my @split = split / /,$_;print "@split"; #i123PPPP 123 Ggg my @new_split = split;print"@new_split\n"; #123PPPP 123 Ggg my @new_split1 = split /\s/;print"@new_split1\n"; #123PPPP 123 Ggg my $glue = 'xxx';my $string = join $glue,@new_split;print "$string\n"; #i123PPPPxxx123xxxGgg $_ = 'aaa bb ddd';
my ($next1,$next2,$next3) = /(\S+) (\S+) (\S+)/;print "$next2\n"; #bb my %hash = ($string =~ /([A-Z]+)([-]+)/gi); foreach my $key(keys %hash)
{
print "$key and $hash{$key}\n";
} #PPPPxxx and 123
#i and 123 $_ = "a\nmmmmmmm\nabc\n\s\s\ssdsfs\n";
print "$1\n" if /(.*c$)/gm; #abc my $time = `date`;print "$time"; #Sun Jun 23 21:34:46 HKT 2019 $^I = ".bak"; my $input = <>;

问题:  cat .txt |perl test.pl 后并无备份文件1.txt.bak?

s///|s()()i|/i|/g|\U|\u|\L|\l|\U\l|split|join|匹配到hash|匹配到变量|`date`|$^I的更多相关文章

  1. g++ -I(大写i) 与-L(大写l)-l(小写l) 的作用与学习

    linux 下 g++编译程序时,-I(大写i) 与-L(大写l)-l(小写l) 的作用 作为一个linux入门级使用者,gcc/g++ 的简单操作已经用过多次, 但是有时稍微复杂一点的程序就会使用到 ...

  2. SqList *L 和 SqList * &L的区别/学习数据结构突然发现不太懂 小祥我查找总结了一下

    小祥在学习李春葆的数据结构教程时发现一个小问题,建立顺序表和输出线性表,这两个函数的形参是不一样的. 代码在这里↓↓↓ //定义顺序表L的结构体 typedef struct { Elemtype d ...

  3. gcc -l参数和-L参数

    转自:http://www.cnblogs.com/benio/archive/2010/10/25/1860394.html -l: -l参数就是用来指定程序要链接的库,-l参数紧接着就是库名,那么 ...

  4. gcc “-I”(大写i),“-L”(大写l),“-l”(小写l)的区别

    我们用gcc编译程序时,可能会用到“-I”(大写i),“-L”(大写l),“-l”(小写l)等参数,下面做个记录: 例: gcc -o hello hello.c -I /home/hello/inc ...

  5. Linux统计文件/目录数量ls -l | grep "^-" | wc -l匹配开头和结尾

    Linux统计文件数量 ls -l | grep "^-" | wc -l “^-”  一般文件 “^d” 目录文件 shell/vim中^表示开头 cat repatterns ...

  6. 链表中LinkList L与LinkList *L 借鉴

    链表中LinkList L与LinkList *L的区别以及(*L).elem,L.elem L->next,(*L)->next的区别typedef struct Node{int el ...

  7. linux之ls -l|grep "^-"|wc -l命令

    查看某文件夹下文件的个数 ls -l |grep "^-"|wc -l 或 find ./company -type f | wc -l 查看某文件夹下文件的个数,包括子文件夹里的 ...

  8. 十八、泛型 l 注解 l Servlet3.0 l 动态代理 l 类加载器基础加强

    l 泛型 l 注解 l Servlet3.0 l 动态代理 l 类加载器 泛型 1 回顾泛型类 泛型类:具有一个或多个泛型变量的类被称之为泛型类. public class A<T> { ...

  9. Python之L.reverse()和L.sort()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #Python之L.reverse()和L.sort() #http://python.jobbole.com ...

随机推荐

  1. Hyperledger Fabric java chaincode 中文乱码问题

    开发java chaincode过程中遇到一个中文乱码的问题.都是官方的demo,请求的sdk是用java写的,部署的chaincode有两种选择(不考虑node),一种go语言写的chaincode ...

  2. abap table control里面各种属性和事件的写法

    SAP中,Table Control是在Screen中用的最广泛的控件之一了,可以实现对多行数据的编辑. 简单来说,Table Control是一组屏幕元素在Screen上的重复出现,这就是它与普通屏 ...

  3. Java基础--基本规则、语法

    一.关键字.保留字.标识符.常量.变量 1.关键字:使用某种语言赋予特殊含义的单词. 2.保留字:没有赋予特殊含义,但以后可能会使用的单词. 3.标识符:自定义的单词,以数字.字母.下划线以及$符组成 ...

  4. qBittorrent+Flex搭建在线视频播放网站

    BT下载工具qbittorrent(当然这里也有其他类似的工具可选如transmission等) 首先安装EPEL源: yum -y install epel-release 安装开发工具包: yum ...

  5. 洛谷P2971 牛的政治Cow Politics

    题目描述 Farmer John's cows are living on \(N (2 \leq N \leq 200,000)\)different pastures conveniently n ...

  6. js根据等号(=)前名称获取参数值

    var GetUrlParam=function (paraName) { var url = document.location.toString(); var arrObj = url.split ...

  7. Net Core构建Angular4应用程序

    在Visual Studio 2017中使用Asp.Net Core构建Angular4应用程序   前言 Visual Studio 2017已经发布了很久了.做为集成了Asp.Net Core 1 ...

  8. Vsftp设置为PASV mode(被动模式传送)

    首先配置vsftpd.conf文件: #vi /etc/vsftpd/vsftpd.conf 在文件的末尾加上: pasv_enable=YES pasv_max_port=30010 pasv_mi ...

  9. 面向切面编程 (AOP )的理解

    AOP的全称: Aspact  Oriented  Programming AOP的目标(作用):让我们可以“专心做事”  日志记录,事务处理,异常捕获,缓存操作. AOP原理 将复杂的需求分解出不同 ...

  10. Setting 之dashboard 点击跳转流程

    设置的主界面的可以通过修改xml中的dashboard_categaries.xml 文件实现,在DashboardSummary.java 文件中的rebuildUI()方法中将xml对应的实体类转 ...